summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorJ William Piggott2017-04-18 16:42:02 +0200
committerJ William Piggott2017-04-19 04:39:05 +0200
commit969bffb748feea71690193ba6c6405e36a22af9b (patch)
tree4794517d389def2706a5e4c3891f6fa8c8cdf939 /sys-utils/hwclock.c
parenthwclock: make epoch functions alpha only (diff)
downloadkernel-qcow2-util-linux-969bffb748feea71690193ba6c6405e36a22af9b.tar.gz
kernel-qcow2-util-linux-969bffb748feea71690193ba6c6405e36a22af9b.tar.xz
kernel-qcow2-util-linux-969bffb748feea71690193ba6c6405e36a22af9b.zip
hwclock: --set and --predict segmentation fault
Segmentation fault for --set or --predict when the --date option is not included. * sys-utils/hwclock.c: exit with an error message when the required --date option is missing. Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r--sys-utils/hwclock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 0c587957d..bb3a9d897 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1505,6 +1505,10 @@ int main(int argc, char **argv)
}
if (ctl.set || ctl.predict) {
+ if (!ctl.date_opt){
+ warnx(_("--date is required for --set or --predict"));
+ hwclock_exit(&ctl, EX_USAGE);
+ }
if (parse_date(&when, ctl.date_opt, NULL))
set_time = when.tv_sec;
else {