]> 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>
Thu, 22 Jun 2017 08:44:35 +0000 (10:44 +0200)
commit2e45524d969440501c83af3c39d5cab41c573e2f
tree004ba2c9d89ba3688200369d0b57ae30bed5e8ee
parentfad561b0e4b862e320b3c7b72527b09bc1b04860
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