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.
This commit is contained in:
Assaf Gordon authored and Pádraig Brady committed 2013-02-13 22:20:10 +00:00
1 parent 54cdb0e88b
commit fff11aca4f
1 file changed
+1 -1
+1 -1
View File
@@ -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));