[PATCH 3/5] hwclock: --set and --predict segmentation fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 sys-utils/hwclock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 0c58795..bb3a9d8 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 {
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux