diff options
author | J William Piggott | 2017-06-18 19:14:40 +0200 |
---|---|---|
committer | J William Piggott | 2017-06-21 01:56:39 +0200 |
commit | 891b43432fb78722fcc03af2be36cbd340716178 (patch) | |
tree | 9b80bb9efaf442570d0fb82507f5183b8daa755b /sys-utils/hwclock.c | |
parent | hwclock: slice up the usage text (diff) | |
download | kernel-qcow2-util-linux-891b43432fb78722fcc03af2be36cbd340716178.tar.gz kernel-qcow2-util-linux-891b43432fb78722fcc03af2be36cbd340716178.tar.xz kernel-qcow2-util-linux-891b43432fb78722fcc03af2be36cbd340716178.zip |
hwclock: add --update-drift check
Only allow --update-drift for --set or --systohc
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r-- | sys-utils/hwclock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 5868ad6fd..7d69b7ac5 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1233,7 +1233,7 @@ usage(const struct hwclock_control *ctl, FILE *out) #if defined(__linux__) && defined(__alpha__) fputs(_(" --epoch <year> epoch input for --setepoch\n"), out); #endif - fputs(_(" --update-drift update drift factor (requires --set or --systohc)\n"), out); + fputs(_(" --update-drift update the RTC drift factor\n"), out); fprintf(out, _( " --noadjfile do not use %1$s\n" " --adjfile <file> use an alternate file to %1$s\n"), _PATH_ADJTIME); @@ -1465,6 +1465,11 @@ int main(int argc, char **argv) if (!ctl.adj_file_name) ctl.adj_file_name = _PATH_ADJTIME; + if (ctl.update && !ctl.set && !ctl.systohc) { + warnx(_("--update-drift requires --set or --systohc")); + hwclock_exit(&ctl, EX_USAGE); + } + if (ctl.noadjfile && !ctl.utc && !ctl.local_opt) { warnx(_("With --noadjfile, you must specify " "either --utc or --localtime")); |