diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2014-05-01 15:50:27 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2014-05-01 20:42:08 +0200 |
commit | 4fdfe821e20a70670b3d03deb2abed5d8c83e51b (patch) | |
tree | 14b65b10a6c9a96452405137ec1bce22424cb204 /stdio-common/tstdiomisc.c | |
parent | 0cdddc25a47509262a9a55a343395971b492b0fa (diff) | |
download | glibc-4fdfe821e20a70670b3d03deb2abed5d8c83e51b.tar.gz |
Correctly handle %p in wprintf (BZ #16890)
Diffstat (limited to 'stdio-common/tstdiomisc.c')
-rw-r--r-- | stdio-common/tstdiomisc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c index 5a25ecc9f0..2e0663a5e5 100644 --- a/stdio-common/tstdiomisc.c +++ b/stdio-common/tstdiomisc.c @@ -46,6 +46,24 @@ t2 (void) return result; } +static int +t3 (void) +{ + char buf[80]; + wchar_t wbuf[80]; + int result = 0; + int retval; + + retval = sprintf (buf, "%p", (char *) NULL); + result |= retval != 5 || strcmp (buf, "(nil)") != 0; + + retval = swprintf (wbuf, sizeof (wbuf) / sizeof (wbuf[0]), + L"%p", (char *) NULL); + result |= retval != 5 || wcscmp (wbuf, L"(nil)") != 0; + + return result; +} + volatile double qnanval; volatile long double lqnanval; /* A sNaN is only guaranteed to be representable in variables with static (or @@ -243,6 +261,7 @@ main (int argc, char *argv[]) result |= t1 (); result |= t2 (); + result |= t3 (); result |= F (); result |= fflush (stdout) == EOF; |