diff options
author | Garrett D'Amore <garrett@damore.org> | 2014-04-29 02:39:57 -0700 |
---|---|---|
committer | Garrett D'Amore <garrett@damore.org> | 2014-04-29 06:32:39 -0700 |
commit | e56bd28502ece54c39ad86fd96643790902bb93e (patch) | |
tree | 7e2b62ce9da1001a99f1a8b3d6d92b8d88e1f801 | |
parent | fec8e666848d54d90131b7c7d63132a3168697c2 (diff) | |
download | illumos-joyent-e56bd28502ece54c39ad86fd96643790902bb93e.tar.gz |
4878 bug with printf and missing unsigned argument
Reviewed by: Andy Stormont <andyjstormont@gmail.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r-- | usr/src/cmd/printf/printf.c | 2 | ||||
-rw-r--r-- | usr/src/test/util-tests/tests/printf/printf_test.ksh | 12 |
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 |