projects
/
platform
/
upstream
/
toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
961e171
)
Fix from Charlie Shepherd: at end of string, don't match the null terminator
author
Rob Landley
<rob@landley.net>
Sun, 4 Nov 2007 21:32:59 +0000
(15:32 -0600)
committer
Rob Landley
<rob@landley.net>
Sun, 4 Nov 2007 21:32:59 +0000
(15:32 -0600)
as a yottabyte suffix. Also, the shift increment needs to be a long constant
on 64-bit platforms for the top three suffixes to mean anything.
lib/lib.c
patch
|
blob
|
history
diff --git
a/lib/lib.c
b/lib/lib.c
index
95ba121
..
ad84dff
100644
(file)
--- a/
lib/lib.c
+++ b/
lib/lib.c
@@
-422,8
+422,10
@@
long atolx(char *c)
char *suffixes="kmgtpe", *end;
long val = strtol(c, &c, 0);
- end = strchr(suffixes, tolower(*c));
- if (end) val *= 1024<<((end-suffixes)*10);
+ if (*c) {
+ end = strchr(suffixes, tolower(*c));
+ if (end) val *= 1024L<<((end-suffixes)*10);
+ }
return val;
}