diff options
author | Andrew Vagin | 2013-12-27 14:45:57 +0100 |
---|---|---|
committer | Karel Zak | 2014-01-06 14:02:21 +0100 |
commit | 5500c817425fb4ccbc4151f232872ff2380c6391 (patch) | |
tree | fa92e4d587485f38d29e0a6d857403d385c7dfc6 /text-utils/hexdump-display.c | |
parent | hexdump: don't access hex after freeing it (diff) | |
download | kernel-qcow2-util-linux-5500c817425fb4ccbc4151f232872ff2380c6391.tar.gz kernel-qcow2-util-linux-5500c817425fb4ccbc4151f232872ff2380c6391.tar.xz kernel-qcow2-util-linux-5500c817425fb4ccbc4151f232872ff2380c6391.zip |
hexdump: convert a variable type according with fmt
hexdump works uncorrectly on Rassberry Pi (raspbian wheezy):
0000000 3200000000 3400000000 3600000000 3800000000 a00000000
000000a
The problem is that the %qx format is used for printing
the (short int) variable.
Here is the output from hexdump with this patch:
0000000 3231 3433 3635 3837 0a39
000000a
Currently raspbian uses hexdump from bsdmainutils.
bsdmainutils: /usr/bin/hexdump
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Diffstat (limited to 'text-utils/hexdump-display.c')
-rw-r--r-- | text-utils/hexdump-display.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/text-utils/hexdump-display.c b/text-utils/hexdump-display.c index 67f426df8..b195a01ae 100644 --- a/text-utils/hexdump-display.c +++ b/text-utils/hexdump-display.c @@ -93,15 +93,15 @@ print(struct hexdump_pr *pr, unsigned char *bp) { switch(pr->bcnt) { case 1: - printf(pr->fmt, *bp); + printf(pr->fmt, (unsigned long long) *bp); break; case 2: memmove(&sval, bp, sizeof(sval)); - printf(pr->fmt, sval); + printf(pr->fmt, (unsigned long long) sval); break; case 4: memmove(&ival, bp, sizeof(ival)); - printf(pr->fmt, ival); + printf(pr->fmt, (unsigned long long) ival); break; case 8: memmove(&Lval, bp, sizeof(Lval)); @@ -130,15 +130,15 @@ print(struct hexdump_pr *pr, unsigned char *bp) { switch(pr->bcnt) { case 1: - printf(pr->fmt, *bp); + printf(pr->fmt, (unsigned long long) *bp); break; case 2: memmove(&sval, bp, sizeof(sval)); - printf(pr->fmt, sval); + printf(pr->fmt, (unsigned long long) sval); break; case 4: memmove(&ival, bp, sizeof(ival)); - printf(pr->fmt, ival); + printf(pr->fmt, (unsigned long long) ival); break; case 8: memmove(&Lval, bp, sizeof(Lval)); |