---
 toys/other/factor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
From fab8f56370abe41374692587c4bf92bdbd8b711a Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Sat, 13 May 2017 12:48:35 -0700
Subject: [PATCH] factor shouldn't give incorrect answers for >64-bit integers.

---
 toys/other/factor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 @@ static void factor(char *s)
     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;
-- 
2.13.0.rc2.291.g57267f2277-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to