From: JingPiao Chen Date: Fri, 7 Jul 2017 01:10:17 +0000 (+0800) Subject: netlink: print unrecognized nlmsgerr in hex X-Git-Tag: v4.19~329 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbb622c06113ffe9114c1b89a3d08ab8eb5ceca7;p=strace netlink: print unrecognized nlmsgerr in hex * netlink.c (decode_nlmsgerr): Replace printstrn with printstr_ex and set QUOTE_FORCE_HEX flag. * tests/netlink_protocol.c (test_nlmsgerr): Update expected output. --- diff --git a/netlink.c b/netlink.c index f74c3a07..ca195359 100644 --- 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; } diff --git a/tests/netlink_protocol.c b/tests/netlink_protocol.c index eadc14fa..3b4791eb 100644 --- a/tests/netlink_protocol.c +++ b/tests/netlink_protocol.c @@ -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 */