summaryrefslogtreecommitdiffstats
path: root/bin/test
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-12-14 23:20:54 +0000
committerache <ache@FreeBSD.org>2001-12-14 23:20:54 +0000
commit7c495473b76bfe054d19aada7e6ea84dbe3b3136 (patch)
tree55c2cb24d5ba708f35909e25631f06ade2f9b384 /bin/test
parent588c679809c6ece7d92038753cba791b10f4e8c1 (diff)
downloadFreeBSD-src-7c495473b76bfe054d19aada7e6ea84dbe3b3136.zip
FreeBSD-src-7c495473b76bfe054d19aada7e6ea84dbe3b3136.tar.gz
POSIX strto*() functions MAY return EINVAL, so don't assume that only one
errno from them allowed and it is always ERANGE
Diffstat (limited to 'bin/test')
-rw-r--r--bin/test/test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/test/test.c b/bin/test/test.c
index 1637c0d..eed394c 100644
--- a/bin/test/test.c
+++ b/bin/test/test.c
@@ -470,7 +470,8 @@ getn(s)
r = strtol(s, &p, 10);
if (errno != 0)
- error("%s: out of range", s);
+ error((errno == EINVAL) ? "%s: bad number" :
+ "%s: out of range", s);
while (isspace((unsigned char)*p))
p++;
@@ -493,7 +494,8 @@ getq(s)
r = strtoq(s, &p, 10);
if (errno != 0)
- error("%s: out of range", s);
+ error((errno == EINVAL) ? "%s: bad number" :
+ "%s: out of range", s);
while (isspace((unsigned char)*p))
p++;
OpenPOWER on IntegriCloud