shithub: watch

Download patch

ref: 73875dcb86ab049fe2c5e4f5939db05d83891d2e
parent: f14ded684461643353f0e1d17932131e3cba1ca4
author: kvik <vp@kvik.link>
date: Mon Jun 10 08:12:56 EDT 2019

check -t period for sanity

--- a/watch.c
+++ b/watch.c
@@ -172,6 +172,7 @@
 void
 main(int argc, char *argv[])
 {
+	int t;
 	char *cmd;
 
 	cmd = "mk";
@@ -179,7 +180,9 @@
 	case 'e':
 		eadd(EARGF(usage())); break;
 	case 't':
-		period = 1000*strtol(EARGF(usage()), nil, 10); break;
+		if((t = strtol(EARGF(usage()), nil, 10)) > 0)
+			period = t*1000;
+		break;
 	case 'G':
 		noregroup = 1; break;
 	default: usage();