]> granicus.if.org Git - strace/commitdiff
netlink: print unrecognized nlmsgerr in hex
authorJingPiao Chen <chenjingpiao@gmail.com>
Fri, 7 Jul 2017 01:10:17 +0000 (09:10 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 7 Jul 2017 16:43:41 +0000 (16:43 +0000)
* netlink.c (decode_nlmsgerr): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/netlink_protocol.c (test_nlmsgerr): Update expected output.

netlink.c
tests/netlink_protocol.c

index f74c3a070a0b286df3d72b4f26c56918d2cdd519..ca195359c208af2b7285a98e6e3a481e026a057f 100644 (file)
--- a/netlink.c
+++ b/netlink.c
@@ -286,7 +286,7 @@ decode_nlmsgerr(struct tcb *const tcp,
        struct nlmsgerr err;
 
        if (len < sizeof(err.error)) {
-               printstrn(tcp, addr, len);
+               printstr_ex(tcp, addr, len, QUOTE_FORCE_HEX);
                return;
        }
 
index eadc14fa0e3bd0618695e7defc9e4c0b8163de8d..3b4791eb1093cff1eb1a27cf2a8ce60574da4f65 100644 (file)
@@ -223,7 +223,8 @@ test_nlmsgerr(const int fd)
 
        rc = sendto(fd, nlh, NLMSG_HDRLEN + 2, MSG_DONTWAIT, NULL, 0);
        printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
-              ", seq=0, pid=0}, \"42\"}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+              ", seq=0, pid=0}, \"\\x34\\x32\"}"
+              ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
               fd, NLMSG_HDRLEN + 2, NLMSG_HDRLEN + 2, sprintrc(rc));
 
        /* error message with room for the error code only */