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.
This commit is contained in:
Cristian Rodríguez 2015-01-14 02:51:41 -03:00 committed by Zbigniew Jędrzejewski-Szmek
parent 3a5afdec90
commit 0814f65ec6

View 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);