[systemd-devel] [PATCH] sysv-generator: only allow regular files in enumerate_sysv()
Lennart Poettering
lennart at poettering.net
Wed Jan 28 11:41:27 PST 2015
On Thu, 22.01.15 07:31, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> On Wed, Jan 14, 2015 at 02:51:41AM -0300, Cristian Rodríguez wrote:
> > Otherwise, if the directory contains other directories we fail
> > at fopen in load_sysv() with EISDIR.
> > ---
> > src/sysv-generator/sysv-generator.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
> > index 2f24ef2..e15a16b 100644
> > --- a/src/sysv-generator/sysv-generator.c
> > +++ b/src/sysv-generator/sysv-generator.c
> > @@ -727,8 +727,10 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
> > _cleanup_free_ char *fpath = NULL, *name = NULL;
> > int r;
> >
> > - if (hidden_file(de->d_name))
> > - continue;
> > + dirent_ensure_type(d, de);
> > +
> > + if (!dirent_is_file(de))
> > + continue;
> >
> Applied.
I reverted pretty much all of this again. There already was an
explicit S_ISREG() check in the loop. There's really no point in
checking the type of the files we enumerate multiple times.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list