diff options
author | Cristian Rodríguez <crrodriguez@opensuse.org> | 2015-01-14 02:51:41 -0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-22 01:14:53 -0500 |
commit | 0814f65ec6feba5efcf0f5b14c054f3c40e4cd8f (patch) | |
tree | 60c5b0642f1f14446cafd788b3aa2232666e9cbf /src/sysv-generator | |
parent | 3a5afdec90a08b1eb6dfeab667783849204ee8bd (diff) |
sysv-generator: only allow regular files in enumerate_sysv()
Otherwise, if the directory contains other directories we fail
at fopen in load_sysv() with EISDIR.
Diffstat (limited to 'src/sysv-generator')
-rw-r--r-- | src/sysv-generator/sysv-generator.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 3279c7f444..b8b77aa035 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -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); |