[hackers] [ubase] Check some more ioctl() calls for errors || sin
commit 88c61c17e8b1631080f381d199d762534c88a1b8
Author: sin <sin_AT_2f30.org>
Date: Sat Jun 28 11:28:19 2014 +0100
Check some more ioctl() calls for errors
diff --git a/TODO b/TODO
index 149e53e..2bc544c 100644
--- a/TODO
+++ b/TODO
_AT_@ -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
index e26fd73..6014f08 100644
--- a/hwclock.c
+++ b/hwclock.c
_AT_@ -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;
_AT_@ -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
Received on Sat Jun 28 2014 - 12:29:19 CEST
This archive was generated by hypermail 2.3.0
: Sat Jun 28 2014 - 12:36:09 CEST