diff options
author | WANG Chao <chaowang@redhat.com> | 2014-01-14 16:26:24 +0800 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2014-01-15 08:51:14 +0900 |
commit | fbd61f27cb637d984b0a15e2d711605d28b3043e (patch) | |
tree | 1cddafdcc7f4d46efd1c198bb996db968923a992 /vmcore-dmesg | |
parent | 69336eb69fc021d00da9fbf2c6b25a4882f2c6b4 (diff) |
vmcore-dmesg: print white-space characters
Some sort of space like "\t" "\n" are used in kernel log. But we treat
them as non-printables and output "\x20%x" for each non-printable. So
let's fix it.
Signed-off-by: WANG Chao <chaowang@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'vmcore-dmesg')
-rw-r--r-- | vmcore-dmesg/vmcore-dmesg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c index df14c89..0345660 100644 --- a/vmcore-dmesg/vmcore-dmesg.c +++ b/vmcore-dmesg/vmcore-dmesg.c @@ -16,6 +16,7 @@ #include <elf.h> #include <stdbool.h> #include <inttypes.h> +#include <ctype.h> /* The 32bit and 64bit note headers make it clear we don't care */ typedef Elf32_Nhdr Elf_Nhdr; @@ -668,7 +669,7 @@ static void dump_dmesg_structured(int fd) for (i = 0; i < text_len; i++) { unsigned char c = log_text(msg)[i]; - if (c < ' ' || c >= 128) + if (!isprint(c) && !isspace(c)) len += sprintf(out_buf + len, "\\x%02x", c); else out_buf[len++] = c; |