summaryrefslogtreecommitdiff
path: root/src/timedate
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-05-17 10:38:37 -0700
committerGitHub <noreply@github.com>2018-05-17 10:38:37 -0700
commitb391a5f5d55f976c8494211b37241d0e7b1cb1c4 (patch)
tree536bb4386824453340c48ab2efdf8c5f2a0707cc /src/timedate
parent94e05c9a09f3031b915178c5ded2787d215f9464 (diff)
parent539a68e0fb719a32560d648df8d4d158afeaaf02 (diff)
downloadsystemd-b391a5f5d55f976c8494211b37241d0e7b1cb1c4.tar.gz
systemd-b391a5f5d55f976c8494211b37241d0e7b1cb1c4.tar.bz2
systemd-b391a5f5d55f976c8494211b37241d0e7b1cb1c4.zip
Merge pull request #9002 from yuwata/fix-timedate
Fixes timedated and cleanups hostnamed
Diffstat (limited to 'src/timedate')
-rw-r--r--src/timedate/timedated.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 6928bb9a97..1f161d4a4e 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -545,10 +545,7 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *
if (!timezone_is_valid(z, LOG_DEBUG))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid time zone '%s'", z);
- r = free_and_strdup(&c->zone, z);
- if (r < 0)
- return r;
- if (r == 0)
+ if (streq_ptr(z, c->zone))
return sd_bus_reply_method_return(m, NULL);
r = bus_verify_polkit_async(
@@ -565,6 +562,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
+ r = free_and_strdup(&c->zone, z);
+ if (r < 0)
+ return r;
+
/* 1. Write new configuration file */
r = context_write_data_timezone(c);
if (r < 0) {