]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Eliminate config_dirs vars which hold a static strv 8824/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 27 Apr 2018 16:20:17 +0000 (18:20 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 7 May 2018 16:17:36 +0000 (18:17 +0200)
src/binfmt/binfmt.c
src/sysctl/sysctl.c
src/sysusers/sysusers.c

index 22296ca1643cbe3f8221d5697c7449d7ee8640a1..0eb9e4601462817bd0106a180c0454303161c84a 100644 (file)
@@ -24,7 +24,6 @@
 #include "terminal-util.h"
 #include "util.h"
 
-static char **config_dirs = CONF_PATHS_STRV("binfmt.d");
 static bool arg_cat_config = false;
 
 static int delete_rule(const char *rule) {
@@ -65,7 +64,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
 
         assert(path);
 
-        r = search_and_fopen(path, "re", NULL, (const char**) config_dirs, &f);
+        r = search_and_fopen(path, "re", NULL, (const char**) CONF_PATHS_STRV("binfmt.d"), &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
@@ -184,7 +183,7 @@ int main(int argc, char *argv[]) {
                 _cleanup_strv_free_ char **files = NULL;
                 char **f;
 
-                r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) config_dirs);
+                r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("binfmt.d"));
                 if (r < 0) {
                         log_error_errno(r, "Failed to enumerate binfmt.d files: %m");
                         goto finish;
index 55aedffc6eebf8f441a35840aa464a2e66231ebe..5489cb96b7a098bf4b4a84955d8a88e17236f9a6 100644 (file)
@@ -29,8 +29,6 @@
 static char **arg_prefixes = NULL;
 static bool arg_cat_config = false;
 
-static char **config_dirs = CONF_PATHS_STRV("sysctl.d");
-
 static int apply_all(OrderedHashmap *sysctl_options) {
         char *property, *value;
         Iterator i;
@@ -85,7 +83,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
 
         assert(path);
 
-        r = search_and_fopen(path, "re", NULL, (const char**) config_dirs, &f);
+        r = search_and_fopen(path, "re", NULL, (const char**) CONF_PATHS_STRV("sysctl.d"), &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
@@ -282,7 +280,7 @@ int main(int argc, char *argv[]) {
                 _cleanup_strv_free_ char **files = NULL;
                 char **f;
 
-                r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) config_dirs);
+                r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("sysctl.d"));
                 if (r < 0) {
                         log_error_errno(r, "Failed to enumerate sysctl.d files: %m");
                         goto finish;
index c9744728d4f8007e22e6c78bf693ec764c9f91e9..92e5851519f4d0c247fcfdb60a73a122e3f49bc5 100644 (file)
@@ -66,8 +66,6 @@ static bool arg_cat_config = false;
 static const char *arg_replace = NULL;
 static bool arg_inline = false;
 
-static char **config_dirs = CONF_PATHS_STRV("sysusers.d");
-
 static OrderedHashmap *users = NULL, *groups = NULL;
 static OrderedHashmap *todo_uids = NULL, *todo_gids = NULL;
 static OrderedHashmap *members = NULL;
@@ -1690,7 +1688,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
         if (streq(fn, "-"))
                 f = stdin;
         else {
-                r = search_and_fopen(fn, "re", arg_root, (const char**) config_dirs, &rf);
+                r = search_and_fopen(fn, "re", arg_root, (const char**) CONF_PATHS_STRV("sysusers.d"), &rf);
                 if (r < 0) {
                         if (ignore_enoent && r == -ENOENT)
                                 return 0;
@@ -1751,7 +1749,7 @@ static int cat_config(void) {
         _cleanup_free_ char *replace_file = NULL;
         int r;
 
-        r = conf_files_list_with_replacement(arg_root, config_dirs, arg_replace, &files, NULL);
+        r = conf_files_list_with_replacement(arg_root, CONF_PATHS_STRV("sysusers.d"), arg_replace, &files, NULL);
         if (r < 0)
                 return r;
 
@@ -1876,7 +1874,7 @@ static int read_config_files(char **args) {
         char **f;
         int r;
 
-        r = conf_files_list_with_replacement(arg_root, config_dirs, arg_replace, &files, &p);
+        r = conf_files_list_with_replacement(arg_root, CONF_PATHS_STRV("sysusers.d"), arg_replace, &files, &p);
         if (r < 0)
                 return r;