summaryrefslogtreecommitdiffstats
path: root/src/timedate
diff options
context:
space:
mode:
Diffstat (limited to 'src/timedate')
-rw-r--r--src/timedate/timedatectl.c12
-rw-r--r--src/timedate/timedated.c3
2 files changed, 13 insertions, 2 deletions
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index e1feeac061..93e69a28b0 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -275,6 +275,7 @@ static int set_local_rtc(int argc, char **argv, void *userdata) {
}
static int set_ntp(int argc, char **argv, void *userdata) {
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus = userdata;
int b, r;
@@ -285,7 +286,16 @@ static int set_ntp(int argc, char **argv, void *userdata) {
if (b < 0)
return log_error_errno(b, "Failed to parse NTP setting '%s': %m", argv[1]);
- r = bus_call_method(bus, bus_timedate, "SetNTP", &error, NULL, "bb", b, arg_ask_password);
+ r = bus_message_new_method_call(bus, &m, bus_timedate, "SetNTP");
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_append(m, "bb", b, arg_ask_password);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ /* Reloading the daemon may take long, hence set a longer timeout here */
+ r = sd_bus_call(bus, m, DAEMON_RELOAD_TIMEOUT_SEC, &error, NULL);
if (r < 0)
return log_error_errno(r, "Failed to set ntp: %s", bus_error_message(&error, r));
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 5ac7c9f8b2..6406d6fefd 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -18,6 +18,7 @@
#include "bus-log-control-api.h"
#include "bus-map-properties.h"
#include "bus-polkit.h"
+#include "bus-unit-util.h"
#include "clock-util.h"
#include "conf-files.h"
#include "constants.h"
@@ -545,7 +546,7 @@ static int unit_enable_or_disable(UnitStatusInfo *u, sd_bus *bus, sd_bus_error *
if (r < 0)
return r;
- r = bus_call_method(bus, bus_systemd_mgr, "Reload", error, NULL, NULL);
+ r = bus_service_manager_reload(bus);
if (r < 0)
return r;