From 969bffb748feea71690193ba6c6405e36a22af9b Mon Sep 17 00:00:00 2001 From: J William Piggott Date: Tue, 18 Apr 2017 10:42:02 -0400 Subject: 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 --- sys-utils/hwclock.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys-utils/hwclock.c') 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 { -- cgit v1.2.3-55-g7522