diff --git a/tools/regression/usr.bin/printf/regress.sh b/tools/regression/usr.bin/printf/regress.sh index 4ce282fb60a1..9df7e3ef60ca 100644 --- a/tools/regression/usr.bin/printf/regress.sh +++ b/tools/regression/usr.bin/printf/regress.sh @@ -2,7 +2,7 @@ REGRESSION_START($1) -echo '1..11' +echo '1..12' REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"') REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123') @@ -15,5 +15,6 @@ REGRESSION_TEST(`m3', `printf "%%%s\n" abc def ghi jkl') REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"') REGRESSION_TEST(`m5', `printf -- "-d\n"') REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc') +REGRESSION_TEST('zero', `printf "%u%u\n" 15') REGRESSION_END() diff --git a/tools/regression/usr.bin/printf/regress.zero.out b/tools/regression/usr.bin/printf/regress.zero.out new file mode 100644 index 000000000000..fa8f08cb6ff8 --- /dev/null +++ b/tools/regression/usr.bin/printf/regress.zero.out @@ -0,0 +1 @@ +150 diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index 4b0934290bcc..2368f184a5cc 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -473,7 +473,7 @@ getnum(intmax_t *ip, uintmax_t *uip, int signedconv) int rval; if (!*gargv) { - *ip = 0; + *ip = *uip = 0; return (0); } if (**gargv == '"' || **gargv == '\'') {