summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorJ William Piggott2017-07-14 21:51:47 +0200
committerJ William Piggott2017-07-16 14:41:54 +0200
commitf7599b4f86f0db5856770fcdaeb599b76ea64b64 (patch)
tree6eaec6e681b6f35a7073724031601602d8ea32e7 /sys-utils/hwclock.c
parentlibfdisk: make fdisk compliant to UEFI/GPT specification on PMBR (diff)
downloadkernel-qcow2-util-linux-f7599b4f86f0db5856770fcdaeb599b76ea64b64.tar.gz
kernel-qcow2-util-linux-f7599b4f86f0db5856770fcdaeb599b76ea64b64.tar.xz
kernel-qcow2-util-linux-f7599b4f86f0db5856770fcdaeb599b76ea64b64.zip
hwclock: --epoch presence test fails
hwclock --setepoch --epoch 0 Will warn that the epoch option is required. The --epoch presence test is made on its argument after it is converted to an integer. This means any value it can be tested for, can also be given as an input. So make the conversion after the presence test, like the --date option does. Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r--sys-utils/hwclock.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index a3cd49a38..445d73635 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -78,7 +78,6 @@
#include "nls.h"
#include "optutils.h"
#include "pathnames.h"
-#include "strutils.h"
#include "hwclock.h"
#include "timeutils.h"
#include "env.h"
@@ -1179,13 +1178,13 @@ manipulate_epoch(const struct hwclock_control *ctl)
printf(_("Kernel is assuming an epoch value of %lu\n"),
epoch);
} else if (ctl->setepoch) {
- if (ctl->epoch_option == 0)
+ if (!ctl->epoch_option)
warnx(_
("To set the epoch value, you must use the 'epoch' "
"option to tell to what value to set it."));
else if (ctl->testing)
printf(_
- ("Not setting the epoch to %lu - testing only.\n"),
+ ("Not setting the epoch to %s - testing only.\n"),
ctl->epoch_option);
else if (set_epoch_rtc(ctl))
printf(_
@@ -1328,8 +1327,6 @@ int main(int argc, char **argv)
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
- strutils_set_exitcode(EX_USAGE);
-
/* Remember what time we were invoked */
gettimeofday(&startup_time, NULL);
@@ -1407,8 +1404,7 @@ int main(int argc, char **argv)
ctl.hwaudit_on = 1;
break;
case OPT_EPOCH:
- ctl.epoch_option = /* --epoch */
- strtoul_or_err(optarg, _("invalid epoch argument"));
+ ctl.epoch_option = optarg; /* --epoch */
break;
#endif
case OPT_NOADJFILE: