diff options
author | Sami Kerola | 2016-07-16 23:15:54 +0200 |
---|---|---|
committer | Sami Kerola | 2017-02-05 00:39:37 +0100 |
commit | 8f729d60fa6d0c84780b7af31adce599694869c8 (patch) | |
tree | 3601199148d6dadee745b42aa9e7a312b898e73c /sys-utils | |
parent | hwclock: clarify set_cmos_epoch() code (diff) | |
download | kernel-qcow2-util-linux-8f729d60fa6d0c84780b7af31adce599694869c8.tar.gz kernel-qcow2-util-linux-8f729d60fa6d0c84780b7af31adce599694869c8.tar.xz kernel-qcow2-util-linux-8f729d60fa6d0c84780b7af31adce599694869c8.zip |
hwclock: move error messages to determine_clock_access_method()
This makes main() a little bit shorter.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/hwclock-rtc.c | 2 | ||||
-rw-r--r-- | sys-utils/hwclock.c | 29 |
2 files changed, 14 insertions, 17 deletions
diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c index e9ca9ce39..8dd47092f 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c @@ -387,7 +387,7 @@ static int get_permissions_rtc(void) } static struct clock_ops rtc = { - N_("Using the /dev interface to the clock."), + N_("Using the rtc interface to the clock."), get_permissions_rtc, read_hardware_clock_rtc, set_hardware_clock_rtc, diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index fe0d6736d..fc476c088 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1189,17 +1189,24 @@ static void determine_clock_access_method(const struct hwclock_control *ctl) if (ctl->directisa) ur = probe_for_cmos_clock(); - #ifdef __linux__ if (!ur) ur = probe_for_rtc_clock(ctl); #endif + if (ur) { + if (ctl->debug) + puts(ur->interface_name); - if (ctl->debug) { - if (ur) - puts(_(ur->interface_name)); - else + } else { + if (ctl->debug) printf(_("No usable clock interface found.\n")); + warnx(_("Cannot access the Hardware Clock via " + "any known method.")); + if (!ctl->debug) + warnx(_("Use the --debug option to see the " + "details of our search for an access " + "method.")); + hwclock_exit(ctl, EX_SOFTWARE); } } @@ -1821,18 +1828,8 @@ int main(int argc, char **argv) if (ctl.debug) out_version(); - if (!ctl.systz && !ctl.predict) { + if (!ctl.systz && !ctl.predict) determine_clock_access_method(&ctl); - if (!ur) { - warnx(_("Cannot access the Hardware Clock via " - "any known method.")); - if (!ctl.debug) - warnx(_("Use the --debug option to see the " - "details of our search for an access " - "method.")); - hwclock_exit(&ctl, EX_SOFTWARE); - } - } if (!ctl.noadjfile && !(ctl.systz && (ctl.utc || ctl.local_opt))) { if ((rc = read_adjtime(&ctl, &adjtime)) != 0) |