[PATCH v2 4/8] netlink: print unrecognized nlmsgerr in hex
JingPiao Chen
chenjingpiao at gmail.com
Fri Jul 7 03:23:50 UTC 2017
* 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 | 2 +-
tests/netlink_protocol.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/netlink.c b/netlink.c
index f74c3a0..ca19535 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 eadc14f..3b4791e 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 */
--
2.7.4
More information about the Strace-devel
mailing list