projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add more of the locale_t interfaces, all dummied out to ignore the locale
[musl]
/
src
/
stdlib
/
atoll.c
diff --git
a/src/stdlib/atoll.c
b/src/stdlib/atoll.c
index
0e03e0a
..
b693048
100644
(file)
--- a/
src/stdlib/atoll.c
+++ b/
src/stdlib/atoll.c
@@
-10,7
+10,8
@@
long long atoll(const char *s)
case '-': neg=1;
case '+': s++;
}
case '-': neg=1;
case '+': s++;
}
+ /* Compute n as a negative number to avoid overflow on LLONG_MIN */
while (isdigit(*s))
while (isdigit(*s))
- n = 10*n
+ *s++ - '0'
;
- return neg ?
-n :
n;
+ n = 10*n
- (*s++ - '0')
;
+ return neg ?
n : -
n;
}
}