>From 68ff89d497fcaffe054f0ca619fd747db8fb4574 Mon Sep 17 00:00:00 2001 From: Assaf Gordon
Date: Mon, 11 Feb 2013 15:39:42 -0500 Subject: [PATCH] numfmt: fix strtol() bug src/numfmt.c: on some system, strtol() returns EINVAL if no conversion was performed. Ignore and continue if so. --- src/numfmt.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/numfmt.c b/src/numfmt.c index d87d8ef..6e7cf2f 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -970,7 +970,10 @@ parse_format_string (char const *fmt) i += strspn (fmt + i, " "); errno = 0; pad = strtol (fmt + i, &endptr, 10); - if (errno != 0) + /* EINVAL can happen if 'base' is invalid (hardcoded as 10, so can't happen), + or if no conversion was performed (on some platforms). Ignore & continue + if no conversion was performed */ + if (errno != 0 && (errno != EINVAL)) error (EXIT_FAILURE, 0, _("invalid format %s (width overflow)"), quote (fmt)); -- 1.7.7.4