[systemd-devel] [PATCH] sysv-generator: only allow regular files in enumerate_sysv()

Cristian Rodríguez crrodriguez at opensuse.org
Wed Jan 14 05:34:56 PST 2015


El 14/01/15 a las 09:21, Colin Guthrie escribió:
> Cristian Rodríguez wrote on 14/01/15 05:51:
>> Otherwise, if the directory contains other directories we fail
>> at fopen in load_sysv() with EISDIR.
>
>> -                        if (hidden_file(de->d_name))
>> -                                continue;
>
> Why are hidden files now processed? I'd still suggest you want to skip
> files ending in ~ at very least, but I don't think any files beginning
> with a . should be processed either.

Heya Colin:

dirent_is_file returns false for hidden_files.

>
>
>> +                        dirent_ensure_type(d, de);
>
> Should the return value be checked here? It's quite unlikely I know, so
> maybe not.


No callers check the return value...

>> +
>> +                        if (!dirent_is_file(de))
>> +                            continue;
>
> If I read the dirent_ensure_type and dirent_is_file code properly, this
> would mean that symlinks to valid sysvinit scripts are now skipped.

dirent_is_file() returns true for symlinks.

Cheers.





More information about the systemd-devel mailing list