From: David Woodhouse Date: Tue, 4 Dec 2007 13:44:05 +0000 (+0100) Subject: hwclock: check for ENODEV X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=833dd2913e940a9ce4589730086b124697e92d7a;p=util-linux hwclock: check for ENODEV /sbin/hwclock is supposed to fall back to using /dev/rtc0 if /dev/rtc isn't working (which it isn't, because mkinitrd creates it with the old device numbers, and we're switching to the new RTC_CLASS driver). Unfortunately, it'll only cope if the error it gets is ENOENT (i.e. the device node doesn't exist). It doesn't fall back to the next device in the list if the error is ENODEV, which is what happens when the device node exists, but there's no driver. Signed-off-by: David Woodhouse Signed-off-by: Karel Zak --- diff --git a/hwclock/rtc.c b/hwclock/rtc.c index 724daf99..46a5b525 100644 --- a/hwclock/rtc.c +++ b/hwclock/rtc.c @@ -113,7 +113,7 @@ open_rtc(void) { for (p=fls; *p; ++p) { int fd = open(*p, O_RDONLY); - if (fd < 0 && errno == ENOENT) + if (fd < 0 && (errno == ENOENT || errno == ENODEV)) continue; rtc_dev_name = *p; return fd;