mirror of
https://github.com/systemd/systemd.git
synced 2025-02-04 21:47:31 +03:00
Merge pull request #18771 from yuwata/timedate-fix-set-local-rtc-18391
timedate: do not ignore fix_system argument in SetLocalRTC method
This commit is contained in:
commit
836590f75b
@ -4,7 +4,7 @@
|
||||
#include <time.h>
|
||||
|
||||
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);
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user