aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/printf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c
index a666ff7ac..b2429c5cf 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -191,6 +191,7 @@ static void print_direc(char *format, unsigned fmt_length,
if (have_width - 1 == have_prec)
have_width = NULL;
+ /* multiconvert sets errno = 0, but %s needs it cleared */
errno = 0;
switch (format[fmt_length - 1]) {
@@ -199,7 +200,7 @@ static void print_direc(char *format, unsigned fmt_length,
break;
case 'd':
case 'i':
- llv = my_xstrtoll(argument);
+ llv = my_xstrtoll(skip_whitespace(argument));
print_long:
if (!have_width) {
if (!have_prec)
@@ -217,7 +218,7 @@ static void print_direc(char *format, unsigned fmt_length,
case 'u':
case 'x':
case 'X':
- llv = my_xstrtoull(argument);
+ llv = my_xstrtoull(skip_whitespace(argument));
/* cheat: unsigned long and long have same width, so... */
goto print_long;
case 's':