diff options
author | J William Piggott | 2017-07-15 21:44:20 +0200 |
---|---|---|
committer | J William Piggott | 2017-07-16 14:41:54 +0200 |
commit | f613c3c2ed1cba062f661b04d0653d6a922f2bcc (patch) | |
tree | 5bee71196e7c4ae87a3ceb0c24078db79b5793dc /sys-utils/hwclock-rtc.c | |
parent | hwclock: remove dead ioctl check (diff) | |
download | kernel-qcow2-util-linux-f613c3c2ed1cba062f661b04d0653d6a922f2bcc.tar.gz kernel-qcow2-util-linux-f613c3c2ed1cba062f661b04d0653d6a922f2bcc.tar.xz kernel-qcow2-util-linux-f613c3c2ed1cba062f661b04d0653d6a922f2bcc.zip |
hwclock: improve RTC epoch messages
Make consistent and improve messages in get_epoch_rtc()
and set_epoch_rtc().
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils/hwclock-rtc.c')
-rw-r--r-- | sys-utils/hwclock-rtc.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c index 580356117..2af2666d2 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c @@ -403,24 +403,21 @@ int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch_p) rtc_fd = open_rtc(ctl); if (rtc_fd < 0) { if (errno == ENOENT) - warnx(_ - ("To manipulate the epoch value in the kernel, we must " - "access the Linux 'rtc' device driver via the device special " - "file. This file does not exist on this system.")); + warnx(_("%s does not exist."), rtc_dev_name); else - warn(_("cannot open rtc device")); + warn(_("cannot open %s"), rtc_dev_name); return 1; } if (ioctl(rtc_fd, RTC_EPOCH_READ, epoch_p) == -1) { - warn(_("ioctl(RTC_EPOCH_READ) to %s failed"), rtc_dev_name); + warn(_("ioctl(%d, RTC_EPOCH_READ, epoch_p) to %s failed"), + rtc_fd, rtc_dev_name); return 1; } if (ctl->debug) - printf(_("we have read epoch %lu from %s " - "with RTC_EPOCH_READ ioctl.\n"), *epoch_p, - rtc_dev_name); + printf(_("ioctl(%d, RTC_EPOCH_READ, epoch_p) to %s succeeded.\n"), + rtc_fd, rtc_dev_name); return 0; } @@ -444,24 +441,22 @@ int set_epoch_rtc(const struct hwclock_control *ctl) rtc_fd = open_rtc(ctl); if (rtc_fd < 0) { if (errno == ENOENT) - warnx(_ - ("To manipulate the epoch value in the kernel, we must " - "access the Linux 'rtc' device driver via the device special " - "file. This file does not exist on this system.")); + warnx(_("%s does not exist."), rtc_dev_name); else - warn(_("cannot open rtc device")); + warn(_("cannot open %s"), rtc_dev_name); return 1; } - if (ctl->debug) - printf(_("setting epoch to %lu " - "with RTC_EPOCH_SET ioctl to %s.\n"), epoch, - rtc_dev_name); if (ioctl(rtc_fd, RTC_EPOCH_SET, epoch) == -1) { - warn(_("ioctl(RTC_EPOCH_SET) to %s failed"), rtc_dev_name); + warn(_("ioctl(%d, RTC_EPOCH_SET, %lu) to %s failed"), + rtc_fd, epoch, rtc_dev_name); return 1; } + if (ctl->debug) + printf(_("ioctl(%d, RTC_EPOCH_SET, %lu) to %s succeeded.\n"), + rtc_fd, epoch, rtc_dev_name); + return 0; } #endif /* __alpha__ */ |