chiark / gitweb /
sysv-generator: only allow regular files in enumerate_sysv()
authorCristian Rodríguez <crrodriguez@opensuse.org>
Wed, 14 Jan 2015 05:51:41 +0000 (02:51 -0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Jan 2015 06:14:53 +0000 (01:14 -0500)
Otherwise, if the directory contains other directories we fail
at fopen in load_sysv() with EISDIR.

src/sysv-generator/sysv-generator.c

index 3279c7f..b8b77aa 100644 (file)
@@ -752,8 +752,10 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
                         struct stat st;
                         int r;
 
-                        if (hidden_file(de->d_name))
-                                continue;
+                        dirent_ensure_type(d, de);
+
+                        if (!dirent_is_file(de))
+                            continue;
 
                         if (fstatat(dirfd(d), de->d_name, &st, 0) < 0) {
                                 log_warning_errno(errno, "stat() failed on %s/%s: %m", *path, de->d_name);