X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fbasic%2Fconf-files.c;h=c0ac202f57f698d68844512d941bdd0b5af18d38;hb=53e1b683907c2f12330f00feb9630150196f064d;hp=d776583c05d9532e1571b19a8ef5873f358bb84b;hpb=96b02bcdf16ddb90228fd51734957d0fb034eb3d;p=thirdparty%2Fsystemd.git diff --git a/src/basic/conf-files.c b/src/basic/conf-files.c index d776583c05d..c0ac202f57f 100644 --- a/src/basic/conf-files.c +++ b/src/basic/conf-files.c @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ /*** This file is part of systemd. @@ -74,16 +75,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; } }