]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-files: if CONF_FILES_REGULAR|CONF_FILES_DIRECTORY is used together allow either...
authorLennart Poettering <lennart@poettering.net>
Thu, 3 Jul 2025 10:10:55 +0000 (12:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 3 Jul 2025 15:41:07 +0000 (17:41 +0200)
This fixes a a bug introduced by
50c81130b69d04288f50217bede709bac6ca2b1a.

src/basic/conf-files.c

index cabdbd0f4ddfea2f7bb6d3eca00e4bf32ca8c249..8b4d3d7548656e92d86579fcd56c06175b944e03 100644 (file)
@@ -136,16 +136,23 @@ static int files_add(
                         continue;
                 }
 
-                /* Is this node a regular file? */
-                if (FLAGS_SET(flags, CONF_FILES_REGULAR) && !S_ISREG(st.st_mode)) {
-                        log_debug("Ignoring '%s/%s', as it is not a regular file.", root, skip_leading_slash(p));
-                        continue;
-                }
+                if (FLAGS_SET(flags, CONF_FILES_REGULAR|CONF_FILES_DIRECTORY)) {
+                        if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) {
+                                log_debug("Ignoring '%s/%s', as it is neither a regular file or directory.", root, skip_leading_slash(p));
+                                continue;
+                        }
+                } else {
+                        /* Is this node a regular file? */
+                        if (FLAGS_SET(flags, CONF_FILES_REGULAR) && !S_ISREG(st.st_mode)) {
+                                log_debug("Ignoring '%s/%s', as it is not a regular file.", root, skip_leading_slash(p));
+                                continue;
+                        }
 
-                /* Is this node a directory? */
-                if (FLAGS_SET(flags, CONF_FILES_DIRECTORY) && !S_ISDIR(st.st_mode)) {
-                        log_debug("Ignoring '%s/%s', as it is not a directory.", root, skip_leading_slash(p));
-                        continue;
+                        /* Is this node a directory? */
+                        if (FLAGS_SET(flags, CONF_FILES_DIRECTORY) && !S_ISDIR(st.st_mode)) {
+                                log_debug("Ignoring '%s/%s', as it is not a directory.", root, skip_leading_slash(p));
+                                continue;
+                        }
                 }
 
                 /* Does this node have the executable bit set?