summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-11-05 17:23:07 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-11-05 17:23:45 +0100
commit8d7cc54ec886e9cd27f4097ed1e68ea9bc5fe456 (patch)
treeb83ab0ac17c964863ab2516a3924b5f2e1322804
parent4f736bf72188699e39ed4e58bd4d9ebf22c068f3 (diff)
downloadrtc-tools-8d7cc54ec886e9cd27f4097ed1e68ea9bc5fe456.tar.gz
rtc: display string describing error number
Use strerror to display user friendly description of errno. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--rtc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rtc.c b/rtc.c
index 1ca128a..b363be6 100644
--- a/rtc.c
+++ b/rtc.c
@@ -21,7 +21,8 @@ static char *rtc_file = "/dev/rtc0";
#define IOCTL(f, r, d, rc) rc = ioctl(f, r, d); \
if (rc) { \
- fprintf(stderr, "%s returned %d (line %d)\n", #r, errno, __LINE__); \
+ fprintf(stderr, "%s returned %s (%d) at line %d\n", #r, \
+ strerror(errno), errno, __LINE__); \
exit(errno); \
}