<constant>SD_PATH_SEARCH_CONFIGURATION_FACTORY</constant>,
<constant>SD_PATH_SEARCH_STATE_FACTORY</constant>,
<constant>SD_PATH_SEARCH_CONFIGURATION</constant>,
- <constant>SD_PATH_SEARCH_SYSCTL</constant>,
<constant>SD_PATH_SYSTEMD_UTIL</constant>,
<constant>SD_PATH_SYSTEMD_SYSTEM_UNIT</constant>,
#include <stdio.h>
#include <sys/stat.h>
-#include "sd-path.h"
-
#include "alloc-util.h"
#include "build.h"
#include "conf-files.h"
return 0;
}
-static int parse_file(OrderedHashmap **sysctl_options, const char *path, bool ignore_enoent, const char **search_paths) {
+static int parse_file(OrderedHashmap **sysctl_options, const char *path, bool ignore_enoent) {
return conf_file_read(
/* root = */ NULL,
- search_paths,
+ (const char**) CONF_PATHS_STRV("sysctl.d"),
path,
parse_line,
sysctl_options,
if (!j)
return log_oom();
- return parse_file(sysctl_options, j, /* ignore_enoent= */ true, /* search_paths= */ NULL);
+ return parse_file(sysctl_options, j, /* ignore_enoent= */ true);
}
static int cat_config(char **files) {
static int run(int argc, char *argv[]) {
_cleanup_ordered_hashmap_free_ OrderedHashmap *sysctl_options = NULL;
- _cleanup_strv_free_ char **search_paths = NULL;
int r;
- r = sd_path_lookup_strv(SD_PATH_SEARCH_SYSCTL, /* suffix= */ NULL, &search_paths);
- if (r < 0)
- return log_error_errno(r, "Failed to get sysctl.d/ search paths: %m");
-
r = parse_argv(argc, argv);
if (r <= 0)
return r;
/* Use (argument):n, where n==1 for the first positional arg */
RET_GATHER(r, parse_line("(argument)", ++pos, *arg, /* invalid_config = */ NULL, &sysctl_options));
else
- RET_GATHER(r, parse_file(&sysctl_options, *arg, /* ignore_enoent= */ false, (const char**) search_paths));
+ RET_GATHER(r, parse_file(&sysctl_options, *arg, false));
}
} else {
_cleanup_strv_free_ char **files = NULL;
- r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) search_paths);
+ r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("sysctl.d"));
if (r < 0)
return log_error_errno(r, "Failed to enumerate sysctl.d files: %m");
return cat_config(files);
STRV_FOREACH(f, files)
- RET_GATHER(r, parse_file(&sysctl_options, *f, /* ignore_enoent= */ true, /* search_paths= */ NULL));
+ RET_GATHER(r, parse_file(&sysctl_options, *f, true));
RET_GATHER(r, read_credential_lines(&sysctl_options));
}