Skip to content
Snippets Groups Projects
Commit 2b3fb53c authored by Martijn Dekker's avatar Martijn Dekker Committed by Herbert Xu
Browse files

mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x))


Op 07-03-18 om 06:26 schreef Herbert Xu:
> Martijn Dekker <martijn@inlv.org> wrote:
>>
>>> Since base is always a constant 0 or a constant 10, never a
>>> user-provided value, the only error that strtoimax will ever report on
>>> glibc systems is ERANGE. Checking only ERANGE therefore preserves the
>>> glibc behaviour, and allows the exact same set of errors to be detected
>>> on non-glibc systems.
>>
>> That makes sense, thanks.
>
> Could you resend your patch with this change please?

OK, see below.

- M.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 81a501b7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -125,7 +125,7 @@ intmax_t atomax(const char *s, int base)
errno = 0;
r = strtoimax(s, &p, base);
 
if (errno != 0)
if (errno == ERANGE)
badnum(s);
 
/*
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment