summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-10-15 12:29:48 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-02-18 10:25:25 +0100
commite0b8a238df5bded9d41d9adf4371123c1b99c1df (patch)
treef051e6b1e18e5bb70cf6ae946b3a13d97223a065 /src/shared/install.c
parentb117044c0962bad1e75895d35a5f916f124b1793 (diff)
downloadsystemd-e0b8a238df5bded9d41d9adf4371123c1b99c1df.tar.gz
shared/install: generate list of files in separate function
No functional change.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 8629304cef..5a1fff47c4 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2820,20 +2820,16 @@ static int split_pattern_into_name_and_instances(const char *pattern, char **out
return 0;
}
-static int read_presets(UnitFileScope scope, const char *root_dir, Presets *presets) {
- _cleanup_(presets_freep) Presets ps = {};
- size_t n_allocated = 0;
- _cleanup_strv_free_ char **files = NULL;
- char **p;
+static int presets_find_config(UnitFileScope scope, const char *root_dir, char ***files) {
int r;
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
- assert(presets);
+ assert(files);
switch (scope) {
case UNIT_FILE_SYSTEM:
- r = conf_files_list(&files, ".preset", root_dir, 0,
+ r = conf_files_list(files, ".preset", root_dir, 0,
"/etc/systemd/system-preset",
"/run/systemd/system-preset",
"/usr/local/lib/systemd/system-preset",
@@ -2846,7 +2842,7 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres
case UNIT_FILE_GLOBAL:
case UNIT_FILE_USER:
- r = conf_files_list(&files, ".preset", root_dir, 0,
+ r = conf_files_list(files, ".preset", root_dir, 0,
"/etc/systemd/user-preset",
"/run/systemd/user-preset",
"/usr/local/lib/systemd/user-preset",
@@ -2858,6 +2854,21 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres
assert_not_reached("Invalid unit file scope");
}
+ return r;
+}
+
+static int read_presets(UnitFileScope scope, const char *root_dir, Presets *presets) {
+ _cleanup_(presets_freep) Presets ps = {};
+ size_t n_allocated = 0;
+ _cleanup_strv_free_ char **files = NULL;
+ char **p;
+ int r;
+
+ assert(scope >= 0);
+ assert(scope < _UNIT_FILE_SCOPE_MAX);
+ assert(presets);
+
+ r = presets_find_config(scope, root_dir, &files);
if (r < 0)
return r;