From b6d8a999cd490665c795ad316a49cc22bdde2fa4 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Wed, 6 Feb 2019 12:29:02 +0100 Subject: [PATCH] Fix wide char format specifier in libio/tst-bz24153.c. On big endian systems the test fails with: tst-bz24153.c:88: numeric comparison failure left: 1660944385 (0x63000001); from: ch right: 99 (0x63); from: L'c' tst-bz24153.c:90: numeric comparison failure left: 1677721601 (0x64000001); from: ch right: 100 (0x64); from: L'd' error: 2 test failures One 'char' ("%c") is stored to the 'wchar_t *': ch = 0x00000001 | 0x63000000 This patch is using "%lc" as format specifier to read a wchar_t. ChangeLog: * libio/tst-bz24153.c (wide): Use wide char format specifier. --- ChangeLog | 4 ++++ libio/tst-bz24153.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3de4ca1f10..605346afcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2019-02-06 Stefan Liebler + + * libio/tst-bz24153.c (wide): Use wide char format specifier. + 2019-02-06 Stefan Liebler * sysdeps/s390/wmemcmp-vx.S: Add strong alias to diff --git a/libio/tst-bz24153.c b/libio/tst-bz24153.c index 85ad1415df..be0e6bfcf1 100644 --- a/libio/tst-bz24153.c +++ b/libio/tst-bz24153.c @@ -84,9 +84,9 @@ wide (const char *path) TEST_COMPARE (getwchar (), L'a'); TEST_COMPARE (getwchar_unlocked (), L'b'); wchar_t ch = 1; - TEST_COMPARE (wscanf (L"%c", &ch), 1); + TEST_COMPARE (wscanf (L"%lc", &ch), 1); TEST_COMPARE (ch, L'c'); - TEST_COMPARE (call_vwscanf (L"%c", &ch), 1); + TEST_COMPARE (call_vwscanf (L"%lc", &ch), 1); TEST_COMPARE (ch, L'd'); fclose (stdin);