From 2b3fb53c6940471955631353b8bdb7d5a4677fd1 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 7 Mar 2018 13:03:26 +0000 Subject: mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x)) Op 07-03-18 om 06:26 schreef Herbert Xu: > Martijn Dekker 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: Herbert Xu --- src/mystring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mystring.c b/src/mystring.c index 0106bd2..de624b8 100644 --- a/src/mystring.c +++ b/src/mystring.c @@ -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); /* -- cgit 1.4.1