mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Fix stronum() regress test and the errno value for out of range numbers.
This commit is contained in:
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
|
||||
for (d = strtonum_data; d->str != NULL; d++) {
|
||||
ntests++;
|
||||
errstr = "some error";
|
||||
value = strtonum(d->str, d->minval, d->maxval, &errstr);
|
||||
value = sudo_strtonum(d->str, d->minval, d->maxval, &errstr);
|
||||
if (d->errnum != 0) {
|
||||
if (errstr == NULL) {
|
||||
sudo_warnx_nodebug("FAIL: \"%s\": missing errstr for errno %d",
|
||||
|
@@ -154,8 +154,9 @@ done:
|
||||
break;
|
||||
case STN_TOOSMALL:
|
||||
/* Skip remaining digits. */
|
||||
while (isdigit(ch))
|
||||
do {
|
||||
ch = *cp++;
|
||||
} while (isdigit(ch));
|
||||
result = 0;
|
||||
errno = ERANGE;
|
||||
if (errstrp != NULL)
|
||||
@@ -163,8 +164,9 @@ done:
|
||||
break;
|
||||
case STN_TOOBIG:
|
||||
/* Skip remaining digits. */
|
||||
while (isdigit(ch))
|
||||
do {
|
||||
ch = *cp++;
|
||||
} while (isdigit(ch));
|
||||
result = 0;
|
||||
errno = ERANGE;
|
||||
if (errstrp != NULL)
|
||||
|
Reference in New Issue
Block a user