Re: [PATCH 5/5] do not overwrite files in leading path
Clemens Buchacher <drizzd@aon.at> writes:
Show 24 quoted lines
> On Thu, Oct 14, 2010 at 12:34:25AM +0200, Clemens Buchacher wrote:
>>
>> If lstat returns with an error other than NOENT, or if
>> check_ok_to_remove is called with anything other than a directory
>> and cache_entry is NULL, we get a segmentation fault. Before, an
>> error was simply ignored. I don't know which is worse.
>
> I suppose we only need the following additional changes.
>
> - die if lstat returns an error other than ENOENT.
>
> - Rewrite verify_clean_subdirectory to not require a cache_entry.
>
> - Expose lstat result and path cache to the caller of
> lstat_cache_matchlen() in verify_absent_1().
>
> - rewrite check_leading_path (or 'verify_clean_path') to
> check the full path and return zero if
> + the leading path contains a symlink or
> + the leading path exists, but the full path does not
> and returns the path length of the offending entry otherwise.
>
> I think that's manageable and much cleaner. I will start to work on
> it as soon as possible.
Thanks. I like seeing people thinking things through ;-).