POSIX strto*() functions MAY return EINVAL, so don't assume that only one
errno from them allowed and it is always ERANGE
This commit is contained in:
parent
23eb26fa51
commit
9ea42c8e34
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87961
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user