]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-files: introduce CONF_FILES_WARN flag and set it at various places 40290/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Jan 2026 04:44:04 +0000 (13:44 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 Jan 2026 14:05:33 +0000 (23:05 +0900)
Closes #40285.

31 files changed:
src/analyze/analyze-nvpcrs.c
src/basic/conf-files.c
src/basic/conf-files.h
src/binfmt/binfmt.c
src/core/ipe-setup.c
src/environment-d-generator/environment-d-generator.c
src/home/homed-manager.c
src/kernel-install/kernel-install.c
src/libsystemd/sd-journal/catalog.c
src/modules-load/modules-load.c
src/network/netdev/netdev.c
src/network/networkctl-config-file.c
src/network/networkd-network.c
src/pcrlock/pcrlock.c
src/repart/repart.c
src/resolve/resolved-dns-delegate.c
src/resolve/resolved-dns-trust-anchor.c
src/resolve/resolved-dnssd.c
src/shared/conf-parser.c
src/shared/conf-parser.h
src/shared/dropin.c
src/shared/exec-util.c
src/shared/hwdb-util.c
src/shared/mount-setup.c
src/shared/pretty-print.c
src/sysctl/sysctl.c
src/sysupdate/sysupdate.c
src/timedate/timedated.c
src/tpm2-setup/tpm2-setup.c
src/udev/net/link-config.c
src/udev/udevadm-util.c

index ae134dfc2b27b5603be3b2173a08d5d929fc7860..ddb850fcef5a321a42dbd0716197aef71fb043cc 100644 (file)
@@ -78,7 +78,7 @@ int verb_nvpcrs(int argc, char *argv[], void *userdata) {
                                 &l,
                                 ".nvpcr",
                                 /* root= */ NULL,
-                                CONF_FILES_REGULAR|CONF_FILES_BASENAME|CONF_FILES_FILTER_MASKED|CONF_FILES_TRUNCATE_SUFFIX,
+                                CONF_FILES_REGULAR|CONF_FILES_BASENAME|CONF_FILES_FILTER_MASKED|CONF_FILES_TRUNCATE_SUFFIX|CONF_FILES_WARN,
                                 CONF_PATHS_NULSTR("nvpcr"));
                 if (r < 0)
                         return log_error_errno(r, "Failed to find .nvpcr files: %m");
index 12290a564603e8f07fe79e01c6fddadf71f03d12..76ff20f07b9f39a11e3b9c7e3a751eeb92284221 100644 (file)
@@ -40,7 +40,11 @@ void conf_file_free_many(ConfFile **array, size_t n) {
         free(array);
 }
 
-static int prepare_dirs(const char *root, char * const *dirs, int *ret_rfd, char **ret_root, char ***ret_dirs) {
+static int conf_files_log_level(ConfFilesFlags flags) {
+        return FLAGS_SET(flags, CONF_FILES_WARN) ? LOG_WARNING : LOG_DEBUG;
+}
+
+static int prepare_dirs(const char *root, ConfFilesFlags flags, char * const *dirs, int *ret_rfd, char **ret_root, char ***ret_dirs) {
         _cleanup_free_ char *root_abs = NULL;
         _cleanup_strv_free_ char **dirs_abs = NULL;
         int r;
@@ -49,14 +53,16 @@ static int prepare_dirs(const char *root, char * const *dirs, int *ret_rfd, char
         assert(ret_root);
         assert(ret_dirs || strv_isempty(dirs));
 
+        int log_level = conf_files_log_level(flags);
+
         r = empty_or_root_harder_to_null(&root);
         if (r < 0)
-                return log_debug_errno(r, "Failed to determine if '%s' points to the root directory: %m", strempty(root));
+                return log_full_errno(log_level, r, "Failed to determine if '%s' points to the root directory: %m", strempty(root));
 
         if (ret_dirs) {
                 dirs_abs = strv_copy(dirs);
                 if (!dirs_abs)
-                        return log_oom();
+                        return log_oom_full(log_level);
         }
 
         if (root) {
@@ -64,7 +70,7 @@ static int prepare_dirs(const char *root, char * const *dirs, int *ret_rfd, char
                  * necessary to modify each config directories here. but needs to normalize the root directory. */
                 r = path_make_absolute_cwd(root, &root_abs);
                 if (r < 0)
-                        return log_debug_errno(r, "Failed to make '%s' absolute: %m", root);
+                        return log_full_errno(log_level, r, "Failed to make '%s' absolute: %m", root);
 
                 path_simplify(root_abs);
         } else if (ret_dirs) {
@@ -72,12 +78,12 @@ static int prepare_dirs(const char *root, char * const *dirs, int *ret_rfd, char
                  * each config directory absolute if relative. */
                 r = path_strv_make_absolute_cwd(dirs_abs);
                 if (r < 0)
-                        return log_debug_errno(r, "Failed to make directories absolute: %m");
+                        return log_full_errno(log_level, r, "Failed to make directories absolute: %m");
         }
 
         _cleanup_close_ int rfd = open(empty_to_root(root_abs), O_CLOEXEC|O_DIRECTORY|O_PATH);
         if (rfd < 0)
-                return log_debug_errno(errno, "Failed to open '%s': %m", empty_to_root(root_abs));
+                return log_full_errno(log_level, errno, "Failed to open '%s': %m", empty_to_root(root_abs));
 
         *ret_rfd = TAKE_FD(rfd);
         *ret_root = TAKE_PTR(root_abs);
@@ -86,30 +92,31 @@ static int prepare_dirs(const char *root, char * const *dirs, int *ret_rfd, char
         return 0;
 }
 
-static int conf_file_prefix_root(ConfFile *c, const char *root) {
+static int conf_file_prefix_root(ConfFile *c, const char *root, ConfFilesFlags flags) {
         char *p;
         int r;
 
         assert(c);
 
+        int log_level = conf_files_log_level(flags);
+
         r = chaseat_prefix_root(c->result, root, &p);
         if (r < 0)
-                return log_debug_errno(r, "Failed to prefix '%s' with root '%s': %m", c->result, root);
+                return log_full_errno(log_level, r, "Failed to prefix '%s' with root '%s': %m", c->result, root);
         free_and_replace(c->result, p);
 
         r = chaseat_prefix_root(c->resolved_path, root, &p);
         if (r < 0)
-                return log_debug_errno(r, "Failed to prefix '%s' with root '%s': %m", c->resolved_path, root);
+                return log_full_errno(log_level, r, "Failed to prefix '%s' with root '%s': %m", c->resolved_path, root);
         free_and_replace(c->resolved_path, p);
 
         /* Do not use chaseat_prefix_root(), as it is for the result of chaseat(), but the path is not chased. */
         p = path_join(empty_to_root(root), skip_leading_slash(c->original_path));
         if (!p)
-                return log_oom_debug();
-        path_simplify(p);
-        free_and_replace(c->original_path, p);
+                return log_oom_full(log_level);
 
-        return 0;
+        path_simplify(p);
+        return free_and_replace(c->original_path, p);
 }
 
 static bool conf_files_need_stat(ConfFilesFlags flags) {
@@ -149,12 +156,14 @@ static int conf_file_chase_and_verify(
         assert(path);
         assert(name);
 
+        int log_level = conf_files_log_level(flags);
+
         root = empty_to_root(root);
 
         r = chaseat(rfd, path, conf_files_chase_flags(flags), &resolved_path, &fd);
         if (r < 0)
-                return log_debug_errno(r, "Failed to chase '%s%s': %m",
-                                       root, skip_leading_slash(original_path));
+                return log_full_errno(log_level, r, "Failed to chase '%s%s': %m",
+                                      root, skip_leading_slash(original_path));
         if (r == 0) {
                 if (FLAGS_SET(flags, CONF_FILES_FILTER_MASKED_BY_SYMLINK)) {
                         /* If the path points to /dev/null in a image or so, then the device node may not exist. */
@@ -163,7 +172,7 @@ static int conf_file_chase_and_verify(
                                         /* Mark this one as masked */
                                         r = set_put_strdup(masked, name);
                                         if (r < 0)
-                                                return log_oom_debug();
+                                                return log_oom_full(log_level);
                                 }
 
                                 return log_debug_errno(SYNTHETIC_ERRNO(ERFKILL),
@@ -174,14 +183,14 @@ static int conf_file_chase_and_verify(
 
                 if (conf_files_need_stat(flags))
                         /* If we need to have stat, skip the entry. */
-                        return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to chase '%s%s': %m",
-                                               root, skip_leading_slash(original_path));
+                        return log_full_errno(log_level, SYNTHETIC_ERRNO(ENOENT), "Failed to chase '%s%s': %m",
+                                              root, skip_leading_slash(original_path));
         }
 
         /* Even if we do not need stat, let's take stat now. The caller may use the info later. */
         if (fd >= 0 && fstat(fd, &st) < 0)
-                return log_debug_errno(errno, "Failed to stat '%s%s': %m",
-                                       root, skip_leading_slash(original_path));
+                return log_full_errno(log_level, errno, "Failed to stat '%s%s': %m",
+                                      root, skip_leading_slash(original_path));
 
         /* Is this a masking entry? */
         if (FLAGS_SET(flags, CONF_FILES_FILTER_MASKED_BY_SYMLINK) && stat_may_be_dev_null(&st)) {
@@ -189,7 +198,7 @@ static int conf_file_chase_and_verify(
                         /* Mark this one as masked */
                         r = set_put_strdup(masked, name);
                         if (r < 0)
-                                return log_oom_debug();
+                                return log_oom_full(log_level);
                 }
 
                 return log_debug_errno(SYNTHETIC_ERRNO(ERFKILL),
@@ -202,7 +211,7 @@ static int conf_file_chase_and_verify(
                         /* Mark this one as masked */
                         r = set_put_strdup(masked, name);
                         if (r < 0)
-                                return log_oom_debug();
+                                return log_oom_full(log_level);
                 }
 
                 return log_debug_errno(SYNTHETIC_ERRNO(ERFKILL),
@@ -259,13 +268,15 @@ int conf_file_new_at(const char *path, int rfd, ConfFilesFlags flags, ConfFile *
         assert(rfd >= 0 || rfd == AT_FDCWD);
         assert(ret);
 
+        int log_level = conf_files_log_level(flags);
+
         _cleanup_free_ char *root = NULL;
-        if (rfd >= 0 && DEBUG_LOGGING)
+        if (rfd >= 0)
                 (void) fd_get_path(rfd, &root);
 
         _cleanup_(conf_file_freep) ConfFile *c = new(ConfFile, 1);
         if (!c)
-                return log_oom_debug();
+                return log_oom_full(log_level);
 
         *c = (ConfFile) {
                 .original_path = strdup(path),
@@ -273,27 +284,27 @@ int conf_file_new_at(const char *path, int rfd, ConfFilesFlags flags, ConfFile *
         };
 
         if (!c->original_path)
-                return log_oom_debug();
+                return log_oom_full(log_level);
 
         r = path_extract_filename(path, &c->name);
         if (r < 0)
-                return log_debug_errno(r, "Failed to extract filename from '%s': %m", path);
+                return log_full_errno(log_level, r, "Failed to extract filename from '%s': %m", path);
 
         _cleanup_free_ char *dirpath = NULL, *resolved_dirpath = NULL;
         r = path_extract_directory(path, &dirpath);
         if (r < 0 && r != -EDESTADDRREQ)
-                return log_debug_errno(r, "Failed to extract directory from '%s': %m", path);
+                return log_full_errno(log_level, r, "Failed to extract directory from '%s': %m", path);
         if (r >= 0) {
                 r = chaseat(rfd, dirpath,
                             CHASE_MUST_BE_DIRECTORY | conf_files_chase_flags(flags),
                             &resolved_dirpath, /* ret_fd= */ NULL);
                 if (r < 0)
-                        return log_debug_errno(r, "Failed to chase '%s%s': %m", empty_to_root(root), skip_leading_slash(dirpath));
+                        return log_full_errno(log_level, r, "Failed to chase '%s%s': %m", empty_to_root(root), skip_leading_slash(dirpath));
         }
 
         c->result = path_join(resolved_dirpath, c->name);
         if (!c->result)
-                return log_oom_debug();
+                return log_oom_full(log_level);
 
         r = conf_file_chase_and_verify(
                         rfd,
@@ -321,7 +332,7 @@ int conf_file_new(const char *path, const char *root, ConfFilesFlags flags, Conf
 
         _cleanup_free_ char *root_abs = NULL;
         _cleanup_close_ int rfd = -EBADF;
-        r = prepare_dirs(root, /* dirs= */ NULL, &rfd, &root_abs, /* ret_dirs= */ NULL);
+        r = prepare_dirs(root, flags, /* dirs= */ NULL, &rfd, &root_abs, /* ret_dirs= */ NULL);
         if (r < 0)
                 return r;
 
@@ -329,7 +340,7 @@ int conf_file_new(const char *path, const char *root, ConfFilesFlags flags, Conf
         if (!root_abs) {
                 r = path_make_absolute_cwd(path, &path_abs);
                 if (r < 0)
-                        return log_debug_errno(r, "Failed to make '%s' absolute: %m", path);
+                        return log_full_errno(conf_files_log_level(flags), r, "Failed to make '%s' absolute: %m", path);
 
                 path = path_abs;
         }
@@ -339,7 +350,7 @@ int conf_file_new(const char *path, const char *root, ConfFilesFlags flags, Conf
         if (r < 0)
                 return r;
 
-        r = conf_file_prefix_root(c, root_abs);
+        r = conf_file_prefix_root(c, root_abs, flags);
         if (r < 0)
                 return r;
 
@@ -372,14 +383,16 @@ static int files_add(
         assert(files);
         assert(masked);
 
+        int log_level = conf_files_log_level(flags);
+
         root = empty_to_root(root);
 
-        FOREACH_DIRENT(de, dir, return log_debug_errno(errno, "Failed to read directory '%s%s': %m",
-                                                       root, skip_leading_slash(original_dirpath))) {
+        FOREACH_DIRENT(de, dir, return log_full_errno(log_level, errno, "Failed to read directory '%s%s': %m",
+                                                      root, skip_leading_slash(original_dirpath))) {
 
                 _cleanup_free_ char *original_path = path_join(original_dirpath, de->d_name);
                 if (!original_path)
-                        return log_oom_debug();
+                        return log_oom_full(log_level);
 
                 /* Does this match the suffix? */
                 if (suffix && !endswith(de->d_name, suffix)) {
@@ -401,7 +414,7 @@ static int files_add(
 
                 _cleanup_free_ char *p = path_join(resolved_dirpath, de->d_name);
                 if (!p)
-                        return log_oom_debug();
+                        return log_oom_full(log_level);
 
                 _cleanup_free_ char *resolved_path = NULL;
                 _cleanup_close_ int fd = -EBADF;
@@ -424,7 +437,7 @@ static int files_add(
 
                 _cleanup_(conf_file_freep) ConfFile *c = new(ConfFile, 1);
                 if (!c)
-                        return log_oom_debug();
+                        return log_oom_full(log_level);
 
                 *c = (ConfFile) {
                         .name = strdup(de->d_name),
@@ -436,12 +449,12 @@ static int files_add(
                 };
 
                 if (!c->name)
-                        return log_oom_debug();
+                        return log_oom_full(log_level);
 
                 r = hashmap_ensure_put(files, &conf_file_hash_ops, c->name, c);
                 if (r < 0) {
                         assert(r == -ENOMEM);
-                        return log_oom_debug();
+                        return log_oom_full(log_level);
                 }
                 assert(r > 0);
 
@@ -451,7 +464,7 @@ static int files_add(
         return 0;
 }
 
-static int dump_files(Hashmap *fh, const char *root, ConfFile ***ret_files, size_t *ret_n_files) {
+static int dump_files(Hashmap *fh, const char *root, ConfFilesFlags flags, ConfFile ***ret_files, size_t *ret_n_files) {
         ConfFile **files = NULL;
         size_t n_files = 0;
         int r;
@@ -464,7 +477,7 @@ static int dump_files(Hashmap *fh, const char *root, ConfFile ***ret_files, size
         /* The entries in the array given by hashmap_dump_sorted() are still owned by the hashmap. */
         r = hashmap_dump_sorted(fh, (void***) &files, &n_files);
         if (r < 0)
-                return log_oom_debug();
+                return log_oom_full(conf_files_log_level(flags));
 
         /* Hence, we need to remove them from the hashmap. */
         FOREACH_ARRAY(i, files, n_files)
@@ -472,7 +485,7 @@ static int dump_files(Hashmap *fh, const char *root, ConfFile ***ret_files, size
 
         if (root)
                 FOREACH_ARRAY(i, files, n_files) {
-                        r = conf_file_prefix_root(*i, root);
+                        r = conf_file_prefix_root(*i, root, flags);
                         if (r < 0)
                                 return r;
                 }
@@ -496,11 +509,13 @@ static int copy_and_sort_files_from_hashmap(
 
         assert(ret);
 
+        int log_level = conf_files_log_level(flags);
+
         /* The entries in the array given by hashmap_dump_sorted() are still owned by the hashmap.
          * Hence, do not use conf_file_free_many() for 'entries' */
         r = hashmap_dump_sorted(fh, (void***) &files, &n_files);
         if (r < 0)
-                return log_oom_debug();
+                return log_oom_full(log_level);
 
         FOREACH_ARRAY(i, files, n_files) {
                 ConfFile *c = *i;
@@ -513,7 +528,7 @@ static int copy_and_sort_files_from_hashmap(
 
                         r = chaseat_prefix_root(c->result, root, &p);
                         if (r < 0)
-                                return log_debug_errno(r, "Failed to prefix '%s' with root '%s': %m", c->result, root);
+                                return log_full_errno(log_level, r, "Failed to prefix '%s' with root '%s': %m", c->result, root);
 
                         if (FLAGS_SET(flags, CONF_FILES_TRUNCATE_SUFFIX) && suffix) {
                                 char *e = endswith(p, suffix);
@@ -524,7 +539,7 @@ static int copy_and_sort_files_from_hashmap(
                         }
 
                         if (strv_consume_with_size(&results, &n_results, TAKE_PTR(p)) < 0)
-                                return log_oom_debug();
+                                return log_oom_full(log_level);
 
                         continue;
                 } else
@@ -537,20 +552,20 @@ static int copy_and_sort_files_from_hashmap(
 
                         _cleanup_free_ char *n = strndup(add, e - add);
                         if (!n)
-                                return log_oom_debug();
+                                return log_oom_full(log_level);
 
                         r = strv_consume_with_size(&results, &n_results, TAKE_PTR(n));
                 } else
                         r = strv_extend_with_size(&results, &n_results, add);
                 if (r < 0)
-                        return log_oom_debug();
+                        return log_oom_full(log_level);
         }
 
         *ret = TAKE_PTR(results);
         return 0;
 }
 
-static int insert_replacement(Hashmap **fh, ConfFile *replacement, const ConfFile **ret) {
+static int insert_replacement(Hashmap **fh, ConfFile *replacement, ConfFilesFlags flags, const ConfFile **ret) {
         _cleanup_(conf_file_freep) ConfFile *c = ASSERT_PTR(replacement);
         int r;
 
@@ -570,7 +585,7 @@ static int insert_replacement(Hashmap **fh, ConfFile *replacement, const ConfFil
         r = hashmap_ensure_put(fh, &conf_file_hash_ops, c->name, c);
         if (r < 0) {
                 assert(r == -ENOMEM);
-                return log_oom_debug();
+                return log_oom_full(conf_files_log_level(flags));
         }
         assert(r > 0);
 
@@ -602,7 +617,7 @@ static int conf_files_list_impl(
         root = empty_to_root(root);
 
         if (replacement) {
-                r = conf_file_new_at(replacement, rfd, /* flags= */ 0, &c);
+                r = conf_file_new_at(replacement, rfd, flags & CONF_FILES_WARN, &c);
                 if (r < 0)
                         return r;
         }
@@ -614,13 +629,14 @@ static int conf_files_list_impl(
                 r = chase_and_opendirat(rfd, *p, CHASE_AT_RESOLVE_IN_ROOT, &path, &dir);
                 if (r < 0) {
                         if (r != -ENOENT)
-                                log_debug_errno(r, "Failed to chase and open directory '%s%s', ignoring: %m",
-                                                root, skip_leading_slash(*p));
+                                log_full_errno(conf_files_log_level(flags), r,
+                                               "Failed to chase and open directory '%s%s', ignoring: %m",
+                                               root, skip_leading_slash(*p));
                         continue;
                 }
 
                 if (c && streq_ptr(path_startswith(c->result, path), c->name)) {
-                        r = insert_replacement(&fh, TAKE_PTR(c), &inserted);
+                        r = insert_replacement(&fh, TAKE_PTR(c), flags, &inserted);
                         if (r < 0)
                                 return r;
                 }
@@ -631,7 +647,7 @@ static int conf_files_list_impl(
         }
 
         if (c) {
-                r = insert_replacement(&fh, TAKE_PTR(c), &inserted);
+                r = insert_replacement(&fh, TAKE_PTR(c), flags, &inserted);
                 if (r < 0)
                         return r;
         }
@@ -657,7 +673,7 @@ int conf_files_list_strv(
 
         assert(ret);
 
-        r = prepare_dirs(root, (char**) dirs, &rfd, &root_abs, &dirs_abs);
+        r = prepare_dirs(root, flags, (char**) dirs, &rfd, &root_abs, &dirs_abs);
         if (r < 0)
                 return r;
 
@@ -686,7 +702,7 @@ int conf_files_list_strv_full(
         assert(ret_files);
         assert(ret_n_files);
 
-        r = prepare_dirs(root, (char**) dirs, &rfd, &root_abs, &dirs_abs);
+        r = prepare_dirs(root, flags, (char**) dirs, &rfd, &root_abs, &dirs_abs);
         if (r < 0)
                 return r;
 
@@ -695,7 +711,7 @@ int conf_files_list_strv_full(
         if (r < 0)
                 return r;
 
-        return dump_files(fh, empty_to_root(root_abs), ret_files, ret_n_files);
+        return dump_files(fh, empty_to_root(root_abs), flags, ret_files, ret_n_files);
 }
 
 int conf_files_list_strv_at(
@@ -712,7 +728,7 @@ int conf_files_list_strv_at(
         assert(rfd >= 0 || rfd == AT_FDCWD);
         assert(ret);
 
-        if (rfd >= 0 && DEBUG_LOGGING)
+        if (rfd >= 0)
                 (void) fd_get_path(rfd, &root); /* for logging */
 
         r = conf_files_list_impl(suffix, rfd, root, flags, dirs, /* replacement= */ NULL, &fh, /* ret_inserted= */ NULL);
@@ -738,14 +754,14 @@ int conf_files_list_strv_at_full(
         assert(ret_files);
         assert(ret_n_files);
 
-        if (rfd >= 0 && DEBUG_LOGGING)
+        if (rfd >= 0)
                 (void) fd_get_path(rfd, &root); /* for logging */
 
         r = conf_files_list_impl(suffix, rfd, root, flags, dirs, /* replacement= */ NULL, &fh, /* ret_inserted= */ NULL);
         if (r < 0)
                 return r;
 
-        return dump_files(fh, /* root= */ NULL, ret_files, ret_n_files);
+        return dump_files(fh, /* root= */ NULL, flags, ret_files, ret_n_files);
 }
 
 int conf_files_list(char ***ret, const char *suffix, const char *root, ConfFilesFlags flags, const char *dir) {
@@ -771,7 +787,7 @@ int conf_files_list_nulstr(char ***ret, const char *suffix, const char *root, Co
 
         d = strv_split_nulstr(dirs);
         if (!d)
-                return -ENOMEM;
+                return log_oom_full(conf_files_log_level(flags));
 
         return conf_files_list_strv(ret, suffix, root, flags, (const char**) d);
 }
@@ -784,7 +800,7 @@ int conf_files_list_nulstr_full(const char *suffix, const char *root, ConfFilesF
 
         d = strv_split_nulstr(dirs);
         if (!d)
-                return -ENOMEM;
+                return log_oom_full(conf_files_log_level(flags));
 
         return conf_files_list_strv_full(suffix, root, flags, (const char**) d, ret_files, ret_n_files);
 }
@@ -796,7 +812,7 @@ int conf_files_list_nulstr_at(char ***ret, const char *suffix, int rfd, ConfFile
 
         d = strv_split_nulstr(dirs);
         if (!d)
-                return -ENOMEM;
+                return log_oom_full(conf_files_log_level(flags));
 
         return conf_files_list_strv_at(ret, suffix, rfd, flags, (const char**) d);
 }
@@ -809,7 +825,7 @@ int conf_files_list_nulstr_at_full(const char *suffix, int rfd, ConfFilesFlags f
 
         d = strv_split_nulstr(dirs);
         if (!d)
-                return -ENOMEM;
+                return log_oom_full(conf_files_log_level(flags));
 
         return conf_files_list_strv_at_full(suffix, rfd, flags, (const char**) d, ret_files, ret_n_files);
 }
@@ -823,7 +839,7 @@ int conf_files_list_with_replacement(
 
         _cleanup_hashmap_free_ Hashmap *fh = NULL;
         _cleanup_free_ char *inserted = NULL;
-        ConfFilesFlags flags = CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED_BY_SYMLINK;
+        ConfFilesFlags flags = CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED_BY_SYMLINK | CONF_FILES_WARN;
         _cleanup_close_ int rfd = -EBADF;
         _cleanup_free_ char *root_abs = NULL;
         _cleanup_strv_free_ char **dirs_abs = NULL;
@@ -832,7 +848,7 @@ int conf_files_list_with_replacement(
 
         assert(ret_files);
 
-        r = prepare_dirs(root, config_dirs, &rfd, &root_abs, &dirs_abs);
+        r = prepare_dirs(root, flags, config_dirs, &rfd, &root_abs, &dirs_abs);
         if (r < 0)
                 return r;
 
@@ -844,7 +860,9 @@ int conf_files_list_with_replacement(
         if (c) {
                 r = chaseat_prefix_root(c->result, root_abs, &inserted);
                 if (r < 0)
-                        return log_debug_errno(r, "Failed to prefix '%s' with root '%s': %m", c->result, empty_to_root(root_abs));
+                        return log_full_errno(conf_files_log_level(flags), r,
+                                              "Failed to prefix '%s' with root '%s': %m",
+                                              c->result, empty_to_root(root_abs));
         }
 
         r = copy_and_sort_files_from_hashmap(fh, ".conf", empty_to_root(root_abs), flags, ret_files);
@@ -860,6 +878,7 @@ int conf_files_list_dropins(
                 char ***ret,
                 const char *dropin_dirname,
                 const char *root,
+                ConfFilesFlags flags,
                 const char * const *dirs) {
 
         _cleanup_strv_free_ char **dropin_dirs = NULL;
@@ -873,9 +892,9 @@ int conf_files_list_dropins(
         suffix = strjoina("/", dropin_dirname);
         r = strv_extend_strv_concat(&dropin_dirs, dirs, suffix);
         if (r < 0)
-                return r;
+                return log_oom_full(conf_files_log_level(flags));
 
-        return conf_files_list_strv(ret, ".conf", root, 0, (const char* const*) dropin_dirs);
+        return conf_files_list_strv(ret, ".conf", root, flags, (const char* const*) dropin_dirs);
 }
 
 /**
index 0e75905b9e4251c7a766aaf1afb79038bc3a0b79..90e5b1bec52f32f40659462caa5dc0945b60b7aa 100644 (file)
@@ -14,6 +14,7 @@ typedef enum ConfFilesFlags {
         CONF_FILES_FILTER_MASKED_BY_EMPTY   = 1 << 5, /* implement masking by empty file */
         CONF_FILES_FILTER_MASKED            = CONF_FILES_FILTER_MASKED_BY_SYMLINK | CONF_FILES_FILTER_MASKED_BY_EMPTY,
         CONF_FILES_TRUNCATE_SUFFIX          = 1 << 6, /* truncate specified suffix from return filename or path */
+        CONF_FILES_WARN                     = 1 << 7, /* warn on some errors */
 } ConfFilesFlags;
 
 typedef struct ConfFile {
@@ -56,6 +57,7 @@ int conf_files_list_dropins(
                 char ***ret,
                 const char *dropin_dirname,
                 const char *root,
+                ConfFilesFlags flags,
                 const char * const *dirs);
 
 typedef int parse_line_t(
index 88af4e8699e319bc64538f6dae791155c8f8ffcb..ee7d2a4d0711e42123bbd44f08a78b2b61bf53ee 100644 (file)
@@ -232,7 +232,7 @@ static int run(int argc, char *argv[]) {
         } else {
                 _cleanup_strv_free_ char **files = NULL;
 
-                r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("binfmt.d"));
+                r = conf_files_list_strv(&files, ".conf", /* root= */ NULL, CONF_FILES_WARN, (const char**) CONF_PATHS_STRV("binfmt.d"));
                 if (r < 0)
                         return log_error_errno(r, "Failed to enumerate binfmt.d files: %m");
 
index b266a9274ebb52f48163c053e02dd1a2270aff28..f263117018ef353c06c75cb3983cd9b250ad77ff 100644 (file)
@@ -36,7 +36,7 @@ int ipe_setup(void) {
                         &policies,
                         ".p7b",
                         /* root= */ NULL,
-                        CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED,
+                        CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
                         CONF_PATHS_NULSTR("ipe"));
         if (r < 0)
                 return log_error_errno(r, "Failed to assemble list of IPE policies: %m");
index 91ffaa24ea0758da0d61e0ff27b9b25234e9c574..3b2384682c9a564bb5fb1bfa8ad725612022ab17 100644 (file)
@@ -52,7 +52,7 @@ static int load_and_print(void) {
         if (r < 0)
                 return r;
 
-        r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char **) dirs);
+        r = conf_files_list_strv(&files, ".conf", /* root= */ NULL, CONF_FILES_WARN, (const char **) dirs);
         if (r < 0)
                 return r;
 
index ce4bedddc17f8a3f06a841f93869ca81b984e78e..85c92192f483df4527935044254eea4d4824990b 100644 (file)
@@ -1521,7 +1521,7 @@ static int manager_load_public_keys(Manager *m) {
                         &files,
                         ".public",
                         NULL,
-                        CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED,
+                        CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
                         KEY_PATHS_NULSTR);
         if (r < 0)
                 return log_error_errno(r, "Failed to assemble list of public key directories: %m");
index a9b148d98c5269bfbcc58c98cc9bd4eb0932b4c4..b80f8d50ee04c8e427a75cd5951c4f08ceb273a4 100644 (file)
@@ -685,7 +685,7 @@ static int context_load_plugins(Context *c) {
                         &c->plugins,
                         ".install",
                         c->rfd,
-                        CONF_FILES_EXECUTABLE | CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED,
+                        CONF_FILES_EXECUTABLE | CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN,
                         STRV_MAKE_CONST("/etc/kernel/install.d", "/usr/lib/kernel/install.d"));
         if (r < 0)
                 return log_error_errno(r, "Failed to find plugins: %m");
index 0751480fe5bfaac656288e43476fa669a3310f2a..9ddbc11089a65b2eb3c76e9e7c60f7c9a50e798a 100644 (file)
@@ -453,7 +453,9 @@ int catalog_update(const char *database, const char *root, const char* const *di
 
         CLEANUP_ARRAY(files, n_files, conf_file_free_many);
 
-        r = conf_files_list_strv_full(".catalog", root, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED, dirs, &files, &n_files);
+        r = conf_files_list_strv_full(".catalog", root,
+                                      CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN,
+                                      dirs, &files, &n_files);
         if (r < 0)
                 return log_error_errno(r, "Failed to get catalog files: %m");
 
index a42e1222cf5e6d8a0485c569536a5d3fb305781a..f644c9f0f0e2716cc22c2ed121008bb49b2a577d 100644 (file)
@@ -423,7 +423,7 @@ static int run(int argc, char *argv[]) {
                         RET_GATHER(ret, modules_list_append_dup(&module_set, *i));
 
                 r = conf_files_list_nulstr_full(".conf", /* root= */ NULL,
-                                                CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED,
+                                                CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN,
                                                 conf_file_dirs, &files, &n_files);
                 if (r < 0)
                         RET_GATHER(ret, log_error_errno(r, "Failed to enumerate modules-load.d files: %m"));
index 945b04e9670a9d49b27f52078df5e53f39fe6817..be35c59fd9c11447b141ee500368a6c14fb355e8 100644 (file)
@@ -1098,7 +1098,7 @@ int netdev_load(Manager *manager) {
 
         assert(manager);
 
-        r = conf_files_list_strv(&files, ".netdev", NULL, 0, NETWORK_DIRS);
+        r = conf_files_list_strv(&files, ".netdev", /* root= */ NULL, CONF_FILES_WARN, NETWORK_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate netdev files: %m");
 
@@ -1127,7 +1127,7 @@ int netdev_reload(Manager *manager) {
 
         assert(manager);
 
-        r = conf_files_list_strv(&files, ".netdev", NULL, 0, NETWORK_DIRS);
+        r = conf_files_list_strv(&files, ".netdev", /* root= */ NULL, CONF_FILES_WARN, NETWORK_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate netdev files: %m");
 
index e4c09b7f7cf9083db50e4e7dad66ff968facc557..36c6c0e8e1c8ce58f57c04640c4c02cde93af5e7 100644 (file)
@@ -106,7 +106,7 @@ static int get_config_files_by_name(
                 if (!dropin_dirname)
                         return -ENOMEM;
 
-                r = conf_files_list_dropins(ret_dropins, dropin_dirname, /* root= */ NULL, NETWORK_DIRS);
+                r = conf_files_list_dropins(ret_dropins, dropin_dirname, /* root= */ NULL, CONF_FILES_WARN, NETWORK_DIRS);
                 if (r < 0)
                         return r;
         }
index 14c51a8e64e0ece9ad637942ff473890e813ee1b..4d1ed4ccca98691341e4a9aa48ab583ccc07587a 100644 (file)
@@ -612,7 +612,7 @@ int network_load(Manager *manager, OrderedHashmap **ret) {
         assert(manager);
         assert(ret);
 
-        r = conf_files_list_strv(&files, ".network", NULL, 0, NETWORK_DIRS);
+        r = conf_files_list_strv(&files, ".network", /* root= */ NULL, CONF_FILES_WARN, NETWORK_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate network files: %m");
 
index d8150e8b2d53783dd659dc444d88c11806501fe5..65fbce1de5e40879547504c221ba456262855f0e 100644 (file)
@@ -1802,7 +1802,9 @@ static int event_log_add_component_dir(EventLog *el, const char *path, char **ba
                         return log_oom();
         }
 
-        r = conf_files_list_strv(&files, ".pcrlock", /* root= */ NULL, CONF_FILES_REGULAR, (const char*const*) search);
+        r = conf_files_list_strv(&files, ".pcrlock", /* root= */ NULL,
+                                 CONF_FILES_REGULAR|CONF_FILES_WARN,
+                                 (const char*const*) search);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate .pcrlock files for component '%s': %m", id);
 
@@ -1829,7 +1831,9 @@ static int event_log_load_components(EventLog *el) {
                           "/usr/local/lib/pcrlock.d",
                           "/usr/lib/pcrlock.d");
 
-        r = conf_files_list_strv(&files, NULL, NULL, CONF_FILES_REGULAR|CONF_FILES_DIRECTORY|CONF_FILES_FILTER_MASKED, (const char*const*) dirs);
+        r = conf_files_list_strv(&files, /* suffix= */ NULL, /* root= */ NULL,
+                                 CONF_FILES_REGULAR|CONF_FILES_DIRECTORY|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
+                                 (const char*const*) dirs);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate .pcrlock files: %m");
 
index cc7955a64f15892cb81b525ff3ab9de8bf7108c6..19bd3441caab29ecd57dbf83ffad5576fd11cb09 100644 (file)
@@ -3375,7 +3375,7 @@ static int context_read_definitions(Context *context) {
                         &files,
                         ".conf",
                         context->definitions ? NULL : arg_root,
-                        CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED,
+                        CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
                         dirs);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate *.conf files: %m");
index 287f9ad1318c60084a70b1b8a72da0ea82f2abd0..b866a5838db2fe37a571640ac5bdf5962019fd70 100644 (file)
@@ -211,7 +211,7 @@ int manager_load_delegates(Manager *m) {
 
         assert(m);
 
-        r = conf_files_list_strv(&files, ".dns-delegate", /* root= */ NULL, /* flags= */ 0, DNS_DELEGATE_SEARCH_DIRS);
+        r = conf_files_list_strv(&files, ".dns-delegate", /* root= */ NULL, CONF_FILES_WARN, DNS_DELEGATE_SEARCH_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate .dns-delegate files: %m");
 
index 970fe1ea5462e9935d348eac42fb71f6f39ba102..0896dc870c3742816ab83cfebb108cf402f7942c 100644 (file)
@@ -437,7 +437,7 @@ static int dns_trust_anchor_load_files(
         assert(suffix);
         assert(loader);
 
-        r = conf_files_list_nulstr(&files, suffix, NULL, 0, trust_anchor_dirs);
+        r = conf_files_list_nulstr(&files, suffix, /* root= */ NULL, CONF_FILES_WARN, trust_anchor_dirs);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate %s trust anchor files: %m", suffix);
 
index d6491ea64fbb8874d568252d61cd1c345a94b85e..977f786913233387f7a13c67608fbc9fb513dc1c 100644 (file)
@@ -225,7 +225,7 @@ int dnssd_load(Manager *manager) {
         if (manager->mdns_support != RESOLVE_SUPPORT_YES)
                 return 0;
 
-        r = conf_files_list_strv(&files, ".dnssd", NULL, 0, DNSSD_SERVICE_DIRS);
+        r = conf_files_list_strv(&files, ".dnssd", /* root= */ NULL, CONF_FILES_WARN, DNSSD_SERVICE_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate .dnssd files: %m");
 
index a9afd51d0e4deedffb80eaad2916f1f79057d544..e5e18558927495cad3e211d0ac4bcb267b922c7e 100644 (file)
@@ -615,7 +615,9 @@ int config_parse_many(
         assert(dropin_dirname);
         assert(table);
 
-        r = conf_files_list_dropins(&files, dropin_dirname, root, conf_file_dirs);
+        r = conf_files_list_dropins(&files, dropin_dirname, root,
+                                    FLAGS_SET(flags, CONFIG_PARSE_WARN) ? CONF_FILES_WARN : 0,
+                                    conf_file_dirs);
         if (r < 0)
                 return log_full_errno(FLAGS_SET(flags, CONFIG_PARSE_WARN) ? LOG_WARNING : LOG_DEBUG, r,
                                       "Failed to list drop-ins in %s: %m", dropin_dirname);
@@ -690,7 +692,7 @@ static int dropins_get_stats_by_path(
         if (!strextend(&dropin_dirname, ".d"))
                 return -ENOMEM;
 
-        r = conf_files_list_dropins(&files, dropin_dirname, /* root= */ NULL, conf_file_dirs);
+        r = conf_files_list_dropins(&files, dropin_dirname, /* root= */ NULL, /* flags= */ 0, conf_file_dirs);
         if (r < 0)
                 return r;
 
@@ -715,7 +717,7 @@ static int dropins_get_stats_by_path(
 int config_get_stats_by_path(
                 const char *suffix,
                 const char *root,
-                unsigned flags,
+                ConfFilesFlags flags,
                 const char* const* dirs,
                 bool check_dropins,
                 Hashmap **ret) {
index ce47ae3173b0a99db5b334a0f249d9a585d89280..b394131b6496d51961608883cbb650d2b69dd838 100644 (file)
@@ -112,7 +112,7 @@ static inline int config_parse_standard_file_with_dropins(
 int config_get_stats_by_path(
                 const char *suffix,
                 const char *root,
-                unsigned flags,
+                ConfFilesFlags flags,
                 const char* const* dirs,
                 bool check_dropins,
                 Hashmap **ret);
index f540f489339eaa77fca4283edc009feda153e582..405a3c0e5d4819d8eb5c093aae33f96baea1bf0f 100644 (file)
@@ -287,7 +287,7 @@ int unit_file_find_dropin_paths(
                 return 0;
         }
 
-        r = conf_files_list_strv(ret, file_suffix, NULL, 0, (const char**) dirs);
+        r = conf_files_list_strv(ret, file_suffix, /* root= */ NULL, CONF_FILES_WARN, (const char**) dirs);
         if (r < 0)
                 return log_warning_errno(r, "Failed to create the list of configuration files: %m");
 
index 9221350fdc336edbdb0d1f2223b01f8aaa2a422c..2e15f311b88537c6b813128f2b8f6f48b15bd92f 100644 (file)
@@ -323,7 +323,7 @@ int execute_directories(
                         &paths,
                         /* suffix= */ NULL,
                         /* root= */ NULL,
-                        CONF_FILES_EXECUTABLE|CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED,
+                        CONF_FILES_EXECUTABLE|CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
                         directories);
         if (r < 0)
                 return log_error_errno(r, "%s: failed to enumerate executables: %m", name);
index 1eab1fb8810224300bc2e55eda67473432f453eb..29942254f37d70cdb8cfbe0a7abb997d3e8c16bd 100644 (file)
@@ -610,7 +610,9 @@ int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool co
 
         CLEANUP_ARRAY(files, n_files, conf_file_free_many);
 
-        r = conf_files_list_strv_full(".hwdb", root, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED, conf_file_dirs, &files, &n_files);
+        r = conf_files_list_strv_full(".hwdb", root,
+                                      CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN,
+                                      conf_file_dirs, &files, &n_files);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate hwdb files: %m");
 
index 9077d086919557c18eaa2cbbe4f5bd877160f5dd..8c6cd2b12b69ae3bc00815361ffca53eb6f12e95 100644 (file)
@@ -418,7 +418,7 @@ static int relabel_extra(void) {
          */
 
         r = conf_files_list(&files, ".relabel", NULL,
-                            CONF_FILES_FILTER_MASKED | CONF_FILES_REGULAR,
+                            CONF_FILES_FILTER_MASKED | CONF_FILES_REGULAR | CONF_FILES_WARN,
                             "/run/systemd/relabel-extra.d/");
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate /run/systemd/relabel-extra.d/, ignoring: %m");
index 06b6647327f596a9a0f30a6c7f4cd29ffca53505..7e04acbcfc111d2e09211544362c87ef21dab74d 100644 (file)
@@ -324,7 +324,7 @@ static int cat_file_by_path(const char *p, bool *newline, CatFlags flags) {
 
         assert(p);
 
-        r = conf_file_new(p, /* root= */ NULL, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED, &c);
+        r = conf_file_new(p, /* root= */ NULL, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN, &c);
         if (r == -ERFKILL) { /* masked */
                 if (newline) {
                         if (*newline)
@@ -339,7 +339,7 @@ static int cat_file_by_path(const char *p, bool *newline, CatFlags flags) {
                 return 0;
         }
         if (r < 0)
-                return log_error_errno(r, "Failed to chase '%s': %m", p);
+                return r;
 
         return cat_file(c, newline, flags);
 }
@@ -486,7 +486,7 @@ int conf_files_cat(const char *root, const char *name, CatFlags flags) {
         ConfFile **dropins = NULL;
         size_t n_dropins = 0;
         CLEANUP_ARRAY(dropins, n_dropins, conf_file_free_many);
-        r = conf_files_list_strv_full(extension, root, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED, (const char* const*) dirs, &dropins, &n_dropins);
+        r = conf_files_list_strv_full(extension, root, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN, (const char* const*) dirs, &dropins, &n_dropins);
         if (r < 0)
                 return log_error_errno(r, "Failed to query file list: %m");
 
index 912e18a95c0caeef8b2ba2ff7fe0457b25a71782..cf7dea24f58d4e8defa807b5ccc1974c5b0af909 100644 (file)
@@ -461,7 +461,8 @@ static int run(int argc, char *argv[]) {
         } else {
                 _cleanup_strv_free_ char **files = NULL;
 
-                r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("sysctl.d"));
+                r = conf_files_list_strv(&files, ".conf", /* root= */ NULL, CONF_FILES_WARN,
+                                         (const char**) CONF_PATHS_STRV("sysctl.d"));
                 if (r < 0)
                         return log_error_errno(r, "Failed to enumerate sysctl.d files: %m");
 
index de3a9d2c485281111cbb481a24112d62794b576f..6702358ccc6f26dd7e4207d2d2db807356a4f8c0 100644 (file)
@@ -136,7 +136,9 @@ static int read_definitions(
         assert(dirs);
         assert(suffix);
 
-        r = conf_files_list_strv_full(suffix, arg_root, CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED, dirs, &files, &n_files);
+        r = conf_files_list_strv_full(suffix, arg_root,
+                                      CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
+                                      dirs, &files, &n_files);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate sysupdate.d/*%s definitions: %m", suffix);
 
@@ -209,7 +211,7 @@ static int context_read_definitions(Context *c, const char* node, bool requires_
         CLEANUP_ARRAY(files, n_files, conf_file_free_many);
 
         r = conf_files_list_strv_full(".feature", arg_root,
-                                      CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED,
+                                      CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED|CONF_FILES_WARN,
                                       (const char**) dirs, &files, &n_files);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate sysupdate.d/*.feature definitions: %m");
@@ -1558,7 +1560,8 @@ static int verb_components(int argc, char **argv, void *userdata) {
 
         CLEANUP_ARRAY(directories, n_directories, conf_file_free_many);
 
-        r = conf_files_list_strv_full(".d", arg_root, CONF_FILES_DIRECTORY, (const char * const *) CONF_PATHS_STRV(""), &directories, &n_directories);
+        r = conf_files_list_strv_full(".d", arg_root, CONF_FILES_DIRECTORY|CONF_FILES_WARN,
+                                      (const char * const *) CONF_PATHS_STRV(""), &directories, &n_directories);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate directories: %m");
 
index d1ef772b5650e95af3ea09c9b0e3f9cc738c2c2f..5ba8644334da540402025f2bfab693dcb9c36d11 100644 (file)
@@ -184,7 +184,9 @@ static int context_parse_ntp_services_from_disk(Context *c) {
         _cleanup_strv_free_ char **files = NULL;
         int r;
 
-        r = conf_files_list_strv(&files, ".list", NULL, CONF_FILES_FILTER_MASKED, UNIT_LIST_DIRS);
+        r = conf_files_list_strv(&files, ".list", /* root= */ NULL,
+                                 CONF_FILES_FILTER_MASKED | CONF_FILES_WARN,
+                                 UNIT_LIST_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate .list files: %m");
 
index c73dd377ed84397c6837de25e26ff0e8306d9354..1d057ea0e24da6c9b39615c46bfbdfe4bb9ce14b 100644 (file)
@@ -450,7 +450,7 @@ static int setup_nvpcr(void) {
                         &l,
                         ".nvpcr",
                         /* root= */ NULL,
-                        CONF_FILES_REGULAR|CONF_FILES_BASENAME|CONF_FILES_FILTER_MASKED|CONF_FILES_TRUNCATE_SUFFIX,
+                        CONF_FILES_REGULAR|CONF_FILES_BASENAME|CONF_FILES_FILTER_MASKED|CONF_FILES_TRUNCATE_SUFFIX|CONF_FILES_WARN,
                         CONF_PATHS_NULSTR("nvpcr"));
         if (r < 0)
                 return log_error_errno(r, "Failed to find .nvpcr files: %m");
index 35dfa0d95a1de6eaa984f683f673f2772fbe42de..378e909b9be3b6ce31686eede8c3165a459ab916 100644 (file)
@@ -342,7 +342,7 @@ int link_config_load(LinkConfigContext *ctx) {
 
         link_configs_free(ctx);
 
-        r = conf_files_list_strv(&files, ".link", NULL, 0, NETWORK_DIRS);
+        r = conf_files_list_strv(&files, ".link", /* root= */ NULL, CONF_FILES_WARN, NETWORK_DIRS);
         if (r < 0)
                 return log_error_errno(r, "failed to enumerate link files: %m");
 
index 4ad4b1e92376d71a8252f8a8f18bce006c1ed841..14b508007f5074ecf89d4075084960bd9bdd48f0 100644 (file)
@@ -304,7 +304,7 @@ static int search_rules_file(const char *s, const char *root, ConfFile ***files,
 
         CLEANUP_ARRAY(f, n, conf_file_free_many);
 
-        r = conf_files_list_strv_full(".rules", root, CONF_FILES_REGULAR, (const char* const*) STRV_MAKE_CONST(s), &f, &n);
+        r = conf_files_list_strv_full(".rules", root, CONF_FILES_REGULAR | CONF_FILES_WARN, (const char* const*) STRV_MAKE_CONST(s), &f, &n);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate rules files in '%s%s': %m", empty_to_root(root), skip_leading_slash(s));
 
@@ -327,7 +327,7 @@ int search_rules_files(char * const *a, const char *root, ConfFile ***ret_files,
         assert(ret_n_files);
 
         if (strv_isempty(a)) {
-                r = conf_files_list_strv_full(".rules", root, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED,
+                r = conf_files_list_strv_full(".rules", root, CONF_FILES_REGULAR | CONF_FILES_FILTER_MASKED | CONF_FILES_WARN,
                                               (const char* const*) CONF_PATHS_STRV("udev/rules.d"), &files, &n_files);
                 if (r < 0)
                         return log_error_errno(r, "Failed to enumerate rules files: %m");