]> granicus.if.org Git - strace/commitdiff
loop: fix printing of the reserved field array items
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 1 Jan 2017 18:13:07 +0000 (21:13 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 4 Jan 2017 13:22:19 +0000 (13:22 +0000)
They are of char type, so "hh" length modifier should be used (otherwise
they are printed incorrectly as they are sign extended implicitly when
passed as printf arguments in case char is a signed type which is true
for most compilers).

* loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx"
in printing routine for array elements of the "reserved" field of
loop_info structure.

loop.c

diff --git a/loop.c b/loop.c
index 2ade8e7a3a01470e828c9bdf2987eb0648f0956f..e43fcaad84fabc7528c2a45d5e0671783c4489a9 100644 (file)
--- a/loop.c
+++ b/loop.c
@@ -82,7 +82,7 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr)
 
        if (!abbrev(tcp))
                tprintf(", lo_init=[%#" PRI_klx ", %#" PRI_klx "]"
-                       ", reserved=[%#x, %#x, %#x, %#x]}",
+                       ", reserved=[%#hhx, %#hhx, %#hhx, %#hhx]}",
                        (kernel_ulong_t) info.lo_init[0],
                        (kernel_ulong_t) info.lo_init[1],
                        info.reserved[0], info.reserved[1],