diff options
author | Scott James Remnant | 2009-09-24 20:59:33 +0200 |
---|---|---|
committer | Karel Zak | 2009-10-13 14:03:30 +0200 |
commit | 304762d663608bbda4661c87d298d77c0629da5e (patch) | |
tree | 84259ac4f77a15e6c26fdc6b9e718f05431cea36 /hwclock/hwclock.c | |
parent | build-sys: clean up gtk-doc usage (diff) | |
download | kernel-qcow2-util-linux-304762d663608bbda4661c87d298d77c0629da5e.tar.gz kernel-qcow2-util-linux-304762d663608bbda4661c87d298d77c0629da5e.tar.xz kernel-qcow2-util-linux-304762d663608bbda4661c87d298d77c0629da5e.zip |
hwclock: do not access hardware clock when using --systz
When using --systz we do not read from the hardware clock, so there
is no need to search for a hardware clock. Indeed, we may be running
hwclock --systz before /dev is mounted.
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
Diffstat (limited to 'hwclock/hwclock.c')
-rw-r--r-- | hwclock/hwclock.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c index 3504f2bed..9cdadfea6 100644 --- a/hwclock/hwclock.c +++ b/hwclock/hwclock.c @@ -1136,9 +1136,11 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, int rc; /* local return code */ bool no_auth; /* User lacks necessary authorization to access the clock */ - no_auth = ur->get_permissions(); - if (no_auth) - return EX_NOPERM; + if (!systz) { + no_auth = ur->get_permissions(); + if (no_auth) + return EX_NOPERM; + } if (!noadjfile && (adjust || set || systohc || (!utc && !local_opt))) { rc = read_adjtime(&adjtime); @@ -1644,16 +1646,19 @@ main(int argc, char **argv) { if (debug) out_version(); - determine_clock_access_method(directisa); - if (!ur) { - fprintf(stderr, - _("Cannot access the Hardware Clock via " - "any known method.\n")); - if (!debug) + if (!systz) { + determine_clock_access_method(directisa); + if (!ur) { fprintf(stderr, - _("Use the --debug option to see the details " - "of our search for an access method.\n")); - hwclock_exit(1); + _("Cannot access the Hardware Clock via " + "any known method.\n")); + if (!debug) + fprintf(stderr, + _("Use the --debug option to see the " + "details of our search for an access " + "method.\n")); + hwclock_exit(1); + } } rc = manipulate_clock(show, adjust, noadjfile, set, set_time, |