From 3db4e7f84cf795de8559ea0d96eaa491999ccf24 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 19 Oct 2018 15:25:41 +0200 Subject: printf: fix printing +-prefixed numbers Thanks to Cristian Ionescu-Idbohrn for noticing. Also fix "%d" ' 42' to skip leading whitespace. function old new delta print_direc 435 454 +19 bb_strtoll 99 103 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes Signed-off-by: Bernhard Reutner-Fischer --- libbb/bb_strtonum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libbb/bb_strtonum.c') diff --git a/libbb/bb_strtonum.c b/libbb/bb_strtonum.c index 2185017b0..cb70f1053 100644 --- a/libbb/bb_strtonum.c +++ b/libbb/bb_strtonum.c @@ -81,7 +81,7 @@ long long FAST_FUNC bb_strtoll(const char *arg, char **endp, int base) /* Check for the weird "feature": * a "-" string is apparently a valid "number" for strto[u]l[l]! * It returns zero and errno is 0! :( */ - first = (arg[0] != '-' ? arg[0] : arg[1]); + first = (arg[0] != '-' && arg[0] != '+' ? arg[0] : arg[1]); if (!isalnum(first)) return ret_ERANGE(); errno = 0; -- cgit v1.2.3