diff options
author | Minghui Liu <minghui.liu.95@gmail.com> | 2018-03-20 17:40:34 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-03-20 20:26:43 -0500 |
commit | 07fc8fc5273070fa4ac99d456c484f96c2ae7341 (patch) | |
tree | e40709229acebba5af06e6cf10afc3ec882e99f2 /lib | |
parent | 279fe0b437f777c1133d8421a94977a9f8867b12 (diff) | |
download | toybox-07fc8fc5273070fa4ac99d456c484f96c2ae7341.tar.gz |
Fix atolx not integer error when used with suffix *d
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -301,12 +301,11 @@ long long atolx(char *numstr) val = xstrtol(numstr, &c, 0); if (c != numstr && *c && (end = strchr(suffixes, tolower(*c)))) { int shift = end-suffixes-2; - ++c; if (shift==-1) val *= 2; else if (!shift) val *= 512; else if (shift>0) { - if (toupper(*c)=='d') while (shift--) val *= 1000; + if (*c && toupper(*c++)=='d') while (shift--) val *= 1000; else val *= 1LL<<(shift*10); } } |