summaryrefslogtreecommitdiffstats
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-05-22 14:22:53 +0200
committerLennart Poettering <lennart@poettering.net>2018-05-23 21:08:27 +0200
commit264afce0986b30402810f2e063b6470a85eee189 (patch)
treed0a86ce18765beaf54ef9665d253592f00078079 /src/shared/install.c
parentMerge pull request #9039 from yuwata/fix-device-allow (diff)
downloadsystemd-264afce0986b30402810f2e063b6470a85eee189.tar.xz
systemd-264afce0986b30402810f2e063b6470a85eee189.zip
install: "user" and "global" scopes are equivalent for user presets
Otherwise querying the preset status of a unit to the user instance gives incorrect results since in this case the scope used by the manager is UNIT_FILE_USER.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 550c553117..424f4ccdbb 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2781,7 +2781,8 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres
assert(scope < _UNIT_FILE_SCOPE_MAX);
assert(presets);
- if (scope == UNIT_FILE_SYSTEM)
+ switch (scope) {
+ case UNIT_FILE_SYSTEM:
r = conf_files_list(&files, ".preset", root_dir, 0,
"/etc/systemd/system-preset",
"/run/systemd/system-preset",
@@ -2791,17 +2792,20 @@ static int read_presets(UnitFileScope scope, const char *root_dir, Presets *pres
"/lib/systemd/system-preset",
#endif
NULL);
- else if (scope == UNIT_FILE_GLOBAL)
+ break;
+
+ case UNIT_FILE_GLOBAL:
+ case UNIT_FILE_USER:
r = conf_files_list(&files, ".preset", root_dir, 0,
"/etc/systemd/user-preset",
"/run/systemd/user-preset",
"/usr/local/lib/systemd/user-preset",
"/usr/lib/systemd/user-preset",
NULL);
- else {
- *presets = (Presets){};
+ break;
- return 0;
+ default:
+ assert_not_reached("Invalid unit file scope");
}
if (r < 0)