chiark / gitweb /
journal: when the same entry is in two files, skip over them in sync
[elogind.git] / src / timedated.c
index 66e50a68687e884f9e3fb1809430f009e78dbcf7..16f54b59d263ecdd9b43cc9919b2fa1550a8fb5b 100644 (file)
@@ -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;
                 }