From: Assaf Gordon Date: Tue, 12 Feb 2013 20:28:22 +0000 (-0500) Subject: numfmt: fix strtol() return code handling X-Git-Tag: v8.21~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fff11aca4faaee33a032cb11d7453c6e938b71b7;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/src/numfmt.c b/src/numfmt.c index d87d8efcee..9a321d6978 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));