]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: remove busywait tristate return status
authorJ William Piggott <elseifthen@gmx.com>
Mon, 31 Jul 2017 15:57:01 +0000 (11:57 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Fri, 4 Aug 2017 12:53:45 +0000 (08:53 -0400)
The select() synchronization branch only returns success or
fail. There is no reason for the busywait branch to do more.
If synchronization fails for any reason then it must exit,
otherwise all drift correction operation will be invalid.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock-rtc.c
sys-utils/hwclock.h

index a660e32bab5e8707cab02cba2bef3d1315e88e31..c50011aec4d6e2e71b214a83bc2949c3a6f2133f 100644 (file)
@@ -216,9 +216,8 @@ static int busywait_for_rtc_clock_tick(const struct hwclock_control *ctl,
                       rtc_dev_name);
        }
 
-       rc = do_rtc_read_ioctl(rtc_fd, &start_time);
-       if (rc)
-               return RTC_BUSYWAIT_FAILED;
+       if (do_rtc_read_ioctl(rtc_fd, &start_time))
+               return 1;
 
        /*
         * Wait for change.  Should be within a second, but in case
@@ -233,13 +232,13 @@ static int busywait_for_rtc_clock_tick(const struct hwclock_control *ctl,
                gettimeofday(&now, NULL);
                if (time_diff(now, begin) > 1.5) {
                        warnx(_("Timed out waiting for time change."));
-                       return RTC_BUSYWAIT_TIMEOUT;
+                       return 1;
                }
        } while (1);
 
        if (rc)
-               return RTC_BUSYWAIT_FAILED;
-       return RTC_BUSYWAIT_OK;
+               return 1;
+       return 0;
 }
 
 /*
index 8843501f3bf728a3ad5d2f8fc62382bf8dc143a8..6943d8d7939ff9ac7f802827363d8e81f066cda1 100644 (file)
@@ -9,12 +9,6 @@
 
 #include "c.h"
 
-enum {
-       RTC_BUSYWAIT_OK = 0,
-       RTC_BUSYWAIT_FAILED,
-       RTC_BUSYWAIT_TIMEOUT
-};
-
 struct hwclock_control {
        char *date_opt;
        char *adj_file_name;