summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/printf/printf.c2
-rw-r--r--usr/src/test/util-tests/tests/printf/printf_test.ksh12
2 files changed, 13 insertions, 1 deletions
diff --git a/usr/src/cmd/printf/printf.c b/usr/src/cmd/printf/printf.c
index bf07982383..c5948ff5e5 100644
--- a/usr/src/cmd/printf/printf.c
+++ b/usr/src/cmd/printf/printf.c
@@ -558,7 +558,7 @@ getnum(intmax_t *ip, uintmax_t *uip, int signedconv)
int rval;
if (!*gargv) {
- *ip = 0;
+ *ip = *uip = 0;
return (0);
}
if (**gargv == '"' || **gargv == '\'') {
diff --git a/usr/src/test/util-tests/tests/printf/printf_test.ksh b/usr/src/test/util-tests/tests/printf/printf_test.ksh
index 22bc5d67ba..da648e5af0 100644
--- a/usr/src/test/util-tests/tests/printf/printf_test.ksh
+++ b/usr/src/test/util-tests/tests/printf/printf_test.ksh
@@ -179,6 +179,18 @@ tests[21][format]='%2$s'
tests[21][args]='abc xyz'
tests[21][result]="xyz"
+typeset -A tests[22]=()
+tests[22][desc]="verify missing signed arg"
+tests[22][format]='%d %d'
+tests[22][args]='151'
+tests[22][result]="151 0"
+
+typeset -A tests[23]=()
+tests[23][desc]="verify missing unsigned arg"
+tests[23][format]='%u %u'
+tests[23][args]='151'
+tests[23][result]="151 0"
+
#debug=yes
for i in "${!tests[@]}"; do