* nlattr.c (fetch_nlattr): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/nlattr.c (test_nlattr): Update expected output.
---
 nlattr.c       | 2 +-
 tests/nlattr.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/nlattr.c b/nlattr.c
index 00f8924..8775d35 100644
--- a/nlattr.c
+++ b/nlattr.c
@@ -36,7 +36,7 @@ fetch_nlattr(struct tcb *const tcp, struct nlattr *const 
nlattr,
             const kernel_ulong_t addr, const kernel_ulong_t len)
 {
        if (len < sizeof(struct nlattr)) {
-               printstrn(tcp, addr, len);
+               printstr_ex(tcp, addr, len, QUOTE_FORCE_HEX);
                return false;
        }
 
diff --git a/tests/nlattr.c b/tests/nlattr.c
index ae3ad4d..f7da752 100644
--- a/tests/nlattr.c
+++ b/tests/nlattr.c
@@ -74,7 +74,7 @@ test_nlattr(const int fd)
        printf("sendto(%d, {{len=%u, type=SOCK_DIAG_BY_FAMILY"
               ", flags=NLM_F_DUMP, seq=0, pid=0}, {udiag_family=AF_UNIX"
               ", udiag_type=SOCK_STREAM, udiag_state=TCP_FIN_WAIT1"
-              ", udiag_ino=0, udiag_cookie=[0, 0]}, \"12\"}, %u"
+              ", udiag_ino=0, udiag_cookie=[0, 0]}, \"\\x31\\x32\"}, %u"
               ", MSG_DONTWAIT, NULL, 0) = %s\n",
               fd, msg_len, msg_len, sprintrc(rc));
 
@@ -154,7 +154,7 @@ test_nlattr(const int fd)
               ", flags=NLM_F_DUMP, seq=0, pid=0}, {udiag_family=AF_UNIX"
               ", udiag_type=SOCK_STREAM, udiag_state=TCP_FIN_WAIT1"
               ", udiag_ino=0, udiag_cookie=[0, 0]}, [{nla_len=%u"
-              ", nla_type=UNIX_DIAG_NAME}, \"12\"]}, %u"
+              ", nla_type=UNIX_DIAG_NAME}, \"\\x31\\x32\"]}, %u"
               ", MSG_DONTWAIT, NULL, 0) = %s\n",
               fd, msg_len, nla->nla_len, msg_len, sprintrc(rc));
 
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to