aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Dekker <martijn@inlv.org>2018-03-07 13:03:26 +0000
committerBen Hutchings <ben@decadent.org.uk>2020-03-28 21:42:54 +0000
commit3f6667917c6cc2c90803e1a3e865f2c3b8b1bbf3 (patch)
tree9f7c09c4638330ecb2de5f5704912664c8be9706
parent8d7c846f252b7eabd7cb7d02e7b53fb5a835402e (diff)
downloadklibc-3f6667917c6cc2c90803e1a3e865f2c3b8b1bbf3.tar.gz
[klibc] dash: mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x))
[ dash commit 2b3fb53c6940471955631353b8bdb7d5a4677fd1 ] 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: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--usr/dash/mystring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/dash/mystring.c b/usr/dash/mystring.c
index 0106bd27d2fea..de624b8917914 100644
--- a/usr/dash/mystring.c
+++ b/usr/dash/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);
/*