diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-09-17 15:26:01 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-09-17 15:26:01 +0200 |
commit | 44e648796b36baac5200e11fb082f3c2faec3b05 (patch) | |
tree | b0314fa9b8ed4e99dc64ef30cfbb504b0341d9c7 /src/basic/conf-files.c | |
parent | 6a4df817d5f44e9421bab68d5b4efe87218cfc46 (diff) |
conf-files: fix check for masking with empty files
Fixes #6831.
Diffstat (limited to 'src/basic/conf-files.c')
-rw-r--r-- | src/basic/conf-files.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/basic/conf-files.c b/src/basic/conf-files.c index d776583c0..907d1350f 100644 --- a/src/basic/conf-files.c +++ b/src/basic/conf-files.c @@ -74,16 +74,21 @@ static int files_add(Hashmap *h, const char *suffix, const char *root, unsigned continue; } - /* We only want executable regular files (or symlinks to them), or symlinks to /dev/null */ - if (S_ISREG(st.st_mode)) { - if ((st.st_mode & 0111) == 0) { /* not executable */ - log_debug("Ignoring %s/%s, as it is not marked executable.", dirpath, de->d_name); + if (!null_or_empty(&st)) { + /* A mask is a symlink to /dev/null or an empty file. It does not even + * have to be executable. Other entries must be regular executable files + * or symlinks to them. */ + if (S_ISREG(st.st_mode)) { + if ((st.st_mode & 0111) == 0) { /* not executable */ + log_debug("Ignoring %s/%s, as it is not marked executable.", + dirpath, de->d_name); + continue; + } + } else { + log_debug("Ignoring %s/%s, as it is neither a regular file nor a mask.", + dirpath, de->d_name); continue; } - - } else if (!null_or_empty(&st)) { /* /dev/null? */ - log_debug("Ignoring %s/%s, as it is not a regular file (or symlink to /dev/null).", dirpath, de->d_name); - continue; } } |