Problems printing AF_UNIX sockaddrs

Neil Campbell lists at
Sat Aug 25 12:21:00 UTC 2007


I was tracing some applications and found that the output of strace
included some non-printable characters, leading various tools such as
'file' and 'less' to refuse to recognise the file as text.  It seemed
that this was due to some strange paths being included in unix domain
sockaddr structs.

I've attached a patch which solves this issue for me, I'd be grateful
for any feedback on it.  Essentially I've refactored printstr() and
added a printstrn() function, and I'm now calling this rather than
tprintf() to display the paths.  This takes care of escaping
non-printable characters for me.

Please let me know what you think.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sockaddr_path.diff
Type: text/x-patch
Size: 4193 bytes
Desc: not available
URL: <>

More information about the Strace-devel mailing list