From b34b57a738b8d475b2ae2ec40c6685f9a50697ee Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 24 Feb 2021 13:06:17 +0900 Subject: [PATCH 1/2] clock-util: rename function argument --- src/shared/clock-util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/clock-util.h b/src/shared/clock-util.h index 3f1ae7abfc6..9e96d50d963 100644 --- a/src/shared/clock-util.h +++ b/src/shared/clock-util.h @@ -4,7 +4,7 @@ #include int clock_is_localtime(const char* adjtime_path); -int clock_set_timezone(int *min); +int clock_set_timezone(int *ret_minutesdelta); int clock_reset_timewarp(void); int clock_get_hwclock(struct tm *tm); int clock_set_hwclock(const struct tm *tm); From 2be6c4758e3c27a3f502735881a355e5bfae97b0 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 24 Feb 2021 13:16:15 +0900 Subject: [PATCH 2/2] timedate: do not ignore fix_system argument in SetLocalRTC method Fixes #18391. --- src/timedate/timedated.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index 563f470f54e..1257d950aee 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -725,7 +725,7 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error if (r < 0) return r; - if (lrtc == c->local_rtc) + if (lrtc == c->local_rtc && !fix_system) return sd_bus_reply_method_return(m, NULL); r = bus_verify_polkit_async( @@ -742,13 +742,15 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error if (r == 0) return 1; - c->local_rtc = lrtc; + if (lrtc != c->local_rtc) { + c->local_rtc = lrtc; - /* 1. Write new configuration file */ - r = context_write_data_local_rtc(c); - if (r < 0) { - log_error_errno(r, "Failed to set RTC to %s: %m", lrtc ? "local" : "UTC"); - return sd_bus_error_set_errnof(error, r, "Failed to set RTC to %s: %m", lrtc ? "local" : "UTC"); + /* 1. Write new configuration file */ + r = context_write_data_local_rtc(c); + if (r < 0) { + log_error_errno(r, "Failed to set RTC to %s: %m", lrtc ? "local" : "UTC"); + return sd_bus_error_set_errnof(error, r, "Failed to set RTC to %s: %m", lrtc ? "local" : "UTC"); + } } /* 2. Tell the kernel our timezone */