diff options
Diffstat (limited to 'bin/date/date.c')
-rw-r--r-- | bin/date/date.c | 7 |
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) |