summaryrefslogtreecommitdiff
path: root/src/timedate/timedated.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-21 17:40:20 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-21 17:40:57 -0400
commit192b98b8fe73c8fb4bb3d6540deb93f5fb6eb9d2 (patch)
tree2796887b755d5a61b0a7f881c20c995983c080ac /src/timedate/timedated.c
parent8e8ba79229bb82248a568f5929143a66f4be45b7 (diff)
timedated: flip internal status after executing operation
timedated would set the internal status before calling out to systemd to do the actual change. When the operation was refused because of a SELinux denial, the state kept in timedated would get out of sync, and the second call from timedatectl would appear to succeed. https://bugzilla.redhat.com/show_bug.cgi?id=1014315
Diffstat (limited to 'src/timedate/timedated.c')
-rw-r--r--src/timedate/timedated.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index ca771d5b33..db9a149ae5 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -646,8 +646,6 @@ static int method_set_ntp(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus
if (r == 0)
return 1;
- c->use_ntp = ntp;
-
r = context_enable_ntp(c, bus, error);
if (r < 0)
return r;
@@ -656,6 +654,8 @@ static int method_set_ntp(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus
if (r < 0)
return r;
+ c->use_ntp = ntp;
+
log_info("Set NTP to %s", c->use_ntp ? "enabled" : "disabled");
sd_bus_emit_properties_changed(bus, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "NTP", NULL);