ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit 88c61c17e8b1631080f381d199d762534c88a1b8
parent debcf4447d5b275d9ce9801d7752c75c6e07b8f1
Author: sin <sin@2f30.org>
Date:   Sat, 28 Jun 2014 11:28:19 +0100

Check some more ioctl() calls for errors

Diffstat:
MTODO | 1-
Mhwclock.c | 6++++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO @@ -27,6 +27,5 @@ Tools to be implemented Misc ==== - * Check all ioctl() calls for failure. * Decide what to do with 'bool vs int' debate. * Beautify passwd(1) + shadow support. diff --git a/hwclock.c b/hwclock.c @@ -76,7 +76,8 @@ readrtctm(struct tm *tm, int fd) struct rtc_time rt; memset(&rt, 0, sizeof(rt)); - ioctl(fd, RTC_RD_TIME, &rt); + if (ioctl(fd, RTC_RD_TIME, &rt) < 0) + eprintf("RTC_RD_TIME:"); tm->tm_sec = rt.tm_sec; tm->tm_min = rt.tm_min; tm->tm_hour = rt.tm_hour; @@ -102,7 +103,8 @@ writertctm(struct tm *tm, int fd) rt.tm_wday = tm->tm_wday; rt.tm_yday = tm->tm_yday; rt.tm_isdst = tm->tm_isdst; - ioctl(fd, RTC_SET_TIME, &rt); + if (ioctl(fd, RTC_SET_TIME, &rt) < 0) + eprintf("RTC_SET_TIME:"); } static void