diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-07-05 17:54:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-07-10 16:39:16 +0200 |
commit | a93993584df69c84bd92c6a13453cab861061a51 (patch) | |
tree | 643fa40fd9ccc1e02fefa2edc8a3a57d270fc964 /src/fstab-generator | |
parent | test-fstab-generator: use test_env (diff) | |
download | systemd-a93993584df69c84bd92c6a13453cab861061a51.tar.xz systemd-a93993584df69c84bd92c6a13453cab861061a51.zip |
bus-unit-util: add common code for reloading PID 1
We have this very similar code in various places, and it#s not entirely
obvious (since we want a prolonged timeout for the reload), hence unify
this at one place.
Diffstat (limited to 'src/fstab-generator')
-rw-r--r-- | src/fstab-generator/fstab-generator.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index b39d93195a..660a98ab92 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -7,6 +7,7 @@ #include "alloc-util.h" #include "bus-error.h" #include "bus-locator.h" +#include "bus-unit-util.h" #include "chase.h" #include "creds-util.h" #include "efi-loader.h" @@ -712,7 +713,6 @@ static int add_mount( static int do_daemon_reload(void) { _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; - _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; int r, k; @@ -722,13 +722,9 @@ static int do_daemon_reload(void) { if (r < 0) return log_error_errno(r, "Failed to get D-Bus connection: %m"); - r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "Reload"); + r = bus_service_manager_reload(bus); if (r < 0) - return bus_log_create_error(r); - - r = sd_bus_call(bus, m, DAEMON_RELOAD_TIMEOUT_SEC, &error, NULL); - if (r < 0) - return log_error_errno(r, "Failed to reload daemon: %s", bus_error_message(&error, r)); + return r; /* We need to requeue the two targets so that any new units which previously were not part of the * targets, and which we now added, will be started. */ |