diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-02-21 17:11:52 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-02-22 14:15:08 +0100 |
commit | 623461c13074542b9a4dd2e7f605b6b7f8be5286 (patch) | |
tree | 3a5c12933192f53d53ba806a9e7aaf985d76263a /src/systemctl/systemctl-enable.c | |
parent | systemctl: systematically rename verb entrypoints verb_xyz() (diff) | |
download | systemd-623461c13074542b9a4dd2e7f605b6b7f8be5286.tar.xz systemd-623461c13074542b9a4dd2e7f605b6b7f8be5286.zip |
systemctl: rework daemon_reload() functions
Let's split out the inner parts of verb_daemon_reload() as a function
daemon_reload() and then stop using the former outside of the verbs
logic, and instead call the latter whenever we need to reload the daemon
as auxiliary opeation.
This should make our logic more systematic as we don't have to provide
fake or misleading argc/argv to verb_daemon_reload() anymore.
Diffstat (limited to 'src/systemctl/systemctl-enable.c')
-rw-r--r-- | src/systemctl/systemctl-enable.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/systemctl/systemctl-enable.c b/src/systemctl/systemctl-enable.c index f258d9643b..3da2cd928a 100644 --- a/src/systemctl/systemctl-enable.c +++ b/src/systemctl/systemctl-enable.c @@ -86,7 +86,9 @@ int verb_enable(int argc, char *argv[], void *userdata) { if (strv_isempty(names)) { if (arg_no_reload || install_client_side()) return 0; - return verb_daemon_reload(argc, argv, userdata); + + r = daemon_reload(ACTION_RELOAD, /* graceful= */ false); + return r > 0 ? 0 : r; } if (streq(verb, "disable")) { @@ -234,9 +236,11 @@ int verb_enable(int argc, char *argv[], void *userdata) { goto finish; /* Try to reload if enabled */ - if (!arg_no_reload) - r = verb_daemon_reload(argc, argv, userdata); - else + if (!arg_no_reload) { + r = daemon_reload(ACTION_RELOAD, /* graceful= */ false); + if (r > 0) + r = 0; + } else r = 0; } |