summaryrefslogtreecommitdiff
path: root/bin/date
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2018-02-13 17:28:12 +0000
committercheloha <cheloha@cvs.openbsd.org>2018-02-13 17:28:12 +0000
commita86ef32701b21fe0f03f023bf9d414f0245936cc (patch)
treed8a93bfc8a2d4b55255cbd58c35edceb28345f29 /bin/date
parent5d694bf80a9049e94e72c6bde5ec71ed531592c3 (diff)
atoll -> strtonum
ok millert@ tb@
Diffstat (limited to 'bin/date')
-rw-r--r--bin/date/date.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/date/date.c b/bin/date/date.c
index 087da9602da..3a3ff3851a3 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: date.c,v 1.51 2017/12/23 20:58:14 cheloha Exp $ */
+/* $OpenBSD: date.c,v 1.52 2018/02/13 17:28:11 cheloha Exp $ */
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
/*
@@ -36,6 +36,7 @@
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -78,7 +79,9 @@ main(int argc, char *argv[])
break;
case 'r': /* user specified seconds */
rflag = 1;
- tval = atoll(optarg);
+ tval = strtonum(optarg, LLONG_MIN, LLONG_MAX, &errstr);
+ if (errstr)
+ errx(1, "seconds is %s: %s", errstr, optarg);
break;
case 'u': /* do everything in UTC */
if (setenv("TZ", "UTC", 1) == -1)