]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: fix unimplemented ioctl test
authorJ William Piggott <elseifthen@gmx.com>
Mon, 24 Jul 2017 00:16:03 +0000 (20:16 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Mon, 31 Jul 2017 20:10:47 +0000 (16:10 -0400)
The rtc driver has not returned EINVAL for unimplemented ioctls since
v2.5.8 in 2002. However, it does return it for other errors; making the
current test potentially problematic. Since 9f3d0fc util-linux assumes
kernel >= 2.6.0 so remove EINVAL as an ioctl test.

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

index 36ce3976142d223a35d6d9c8d09fb763c77497f5..ea8357daf913e735102d4de4962f2dc48d63bdfa 100644 (file)
@@ -257,7 +257,7 @@ static int synchronize_to_clock_tick_rtc(const struct hwclock_control *ctl)
                 * they should.
                 */
                rc = -1;
-               errno = EINVAL;
+               errno = ENOTTY;
 #else
                rc = ioctl(rtc_fd, RTC_UIE_ON, 0);
 #endif
@@ -293,7 +293,7 @@ static int synchronize_to_clock_tick_rtc(const struct hwclock_control *ctl)
                        if (rc == -1)
                                warn(_("ioctl() to %s to turn off update interrupts failed"),
                                     rtc_dev_name);
-               } else if (errno == ENOTTY || errno == EINVAL) {
+               } else if (errno == ENOTTY) {
                        /*
                         * This rtc device doesn't have interrupt functions.
                         * This is typical on an Alpha, where the Hardware