X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdlib%2Fstrtoull.c;h=5d1c4ee518553ee00fa7644e5fb596e8dab27770;hb=f4ad36c4bf23899a3164ebd40ff5781c152bcb01;hp=20aa7bdeca007db15083572dbd3620dabdff1858;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/stdlib/strtoull.c b/src/stdlib/strtoull.c index 20aa7bde..5d1c4ee5 100644 --- a/src/stdlib/strtoull.c +++ b/src/stdlib/strtoull.c @@ -5,8 +5,11 @@ unsigned long long strtoull(const char *s, char **p, int base) { - uintmax_t x = strtoumax(s, p, base); - if (x > ULLONG_MAX) { + intmax_t x; + if (sizeof(intmax_t) == sizeof(long long)) + return strtoumax(s, p, base); + x = strtoimax(s, p, base); + if (-x > ULLONG_MAX || x > ULLONG_MAX) { errno = ERANGE; return ULLONG_MAX; }