X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftimedated.c;h=16f54b59d263ecdd9b43cc9919b2fa1550a8fb5b;hb=75d3fc60f88e08bf953063819a8a04b881d6db23;hp=b2a56e7cb0d7b1f39a0f9f527443b74602f115df;hpb=ad740100d108282d0244d5739d4dcc86fe4c5fde;p=elogind.git diff --git a/src/timedated.c b/src/timedated.c index b2a56e7cb..16f54b59d 100644 --- a/src/timedated.c +++ b/src/timedated.c @@ -70,7 +70,7 @@ #define INTERFACES_LIST \ BUS_GENERIC_INTERFACES_LIST \ - "org.freedesktop.locale1\0" + "org.freedesktop.timedate1\0" const char timedate_interface[] _introspect_("timedate1") = INTERFACE; @@ -170,8 +170,24 @@ static int read_data(void) { free_data(); r = read_one_line_file("/etc/timezone", &zone); - if (r < 0 && r != -ENOENT) - return r; + if (r < 0) { + if (r != -ENOENT) + log_warning("Failed to read /etc/timezone: %s", strerror(-r)); + +#ifdef TARGET_FEDORA + r = parse_env_file("/etc/sysconfig/clock", NEWLINE, + "ZONE", &zone, + NULL); + + if (r < 0 && r != -ENOENT) + log_warning("Failed to read /etc/sysconfig/clock: %s", strerror(-r)); +#endif + } + + if (isempty(zone)) { + free(zone); + zone = NULL; + } verify_timezone(); @@ -246,7 +262,7 @@ static int write_data_local_rtc(void) { p++; e = strchr(p, '\n'); - if (!p) { + if (!e) { free(s); return -EIO; }