commit | 57605d2b481a87af4ba444761ece592d441950b1 | [log] [tgz] |
---|---|---|
author | Elliott Hughes <enh@google.com> | Sat May 13 12:48:35 2017 -0700 |
committer | Rob Landley <rob@landley.net> | Sun May 14 23:21:34 2017 -0500 |
tree | a44926c087be33da8a0e4c11d527cc64b4e5006e | |
parent | cf6a235279e84028e8edd3e75f585cd6dbfa40d5 [diff] |
factor shouldn't give incorrect answers for >64-bit integers.
diff --git a/toys/other/factor.c b/toys/other/factor.c index 0e07d71..f0e69c5 100644 --- a/toys/other/factor.c +++ b/toys/other/factor.c
@@ -29,8 +29,9 @@ if (*s=='-') dash = *s++; if (!*s) return; + errno = 0; l = strtoull(s, &s, 0); - if (*s && !isspace(*s)) { + if (errno || (*s && !isspace(*s))) { error_msg("%s: not integer", err); while (*s && !isspace(*s)) s++; continue;