]> git.ipfire.org Git - thirdparty/util-linux.git/commit
dmesg: print only 2 hex digits for each hex-escaped byte
authorIvan Delalande <colona@arista.com>
Wed, 21 Jun 2017 23:43:05 +0000 (16:43 -0700)
committerKarel Zak <kzak@redhat.com>
Fri, 23 Jun 2017 13:26:47 +0000 (15:26 +0200)
commit7dcd597f476a97f8718a68df9d6d02a81e6dd524
tree4ba5c4192d07eb1e5b3c8e8b5733a04660b088ea
parenta51be7457349b5924c36debd785414ac7d65b7e5
dmesg: print only 2 hex digits for each hex-escaped byte

As buf is passed as a signed char buffer in fwrite_hex, fprintf will
print every byte from 0x80 as a signed-extended int causing each of
these bytes to be printed as "\xffffff80" and such, which can be pretty
confusing. Force fprintf to use the argument as a char to make it print
only 2 digits, e.g. "\x80".

Signed-off-by: Ivan Delalande <colona@arista.com>
sys-utils/dmesg.c