summaryrefslogtreecommitdiff
path: root/src/numfmt.c
diff options
context:
space:
mode:
authorAssaf Gordon <assafgordon@gmail.com>2013-02-12 15:28:22 -0500
committerPádraig Brady <P@draigBrady.com>2013-02-13 22:20:10 +0000
commitfff11aca4faaee33a032cb11d7453c6e938b71b7 (patch)
treeec656749dd7ba19050088e15687f61b4c6e22b05 /src/numfmt.c
parent54cdb0e88bea464f0fda8649885bf21dcf56df4e (diff)
downloadcoreutils-fff11aca4faaee33a032cb11d7453c6e938b71b7.tar.xz
numfmt: fix strtol() return code handling
src/numfmt.c (parse_format_string): On some systems, strtol() returns EINVAL if no conversion was performed. So only handle ERANGE here, and handle other format errors directly.
Diffstat (limited to 'src/numfmt.c')
-rw-r--r--src/numfmt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/numfmt.c b/src/numfmt.c
index d87d8efce..9a321d697 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -970,7 +970,7 @@ parse_format_string (char const *fmt)
i += strspn (fmt + i, " ");
errno = 0;
pad = strtol (fmt + i, &endptr, 10);
- if (errno != 0)
+ if (errno == ERANGE)
error (EXIT_FAILURE, 0,
_("invalid format %s (width overflow)"), quote (fmt));