[PATCH] net.c (printsock): Output AF_UNIX socket address using printstr

Dmitry V. Levin ldv at altlinux.org
Wed Sep 26 11:24:37 UTC 2007


Hi,

On Wed, Sep 26, 2007 at 10:28:58AM +0100, Neil Campbell wrote:
> Dmitry V. Levin wrote:
> > On Sat, Aug 25, 2007 at 01:21:00PM +0100, Neil Campbell wrote:
> >> 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.
> > 
> > While your suggestion to avoid unprintable characters in output is right,
> > your patch looks too intrusive: printstr() seems to be enough, and
> > strnlen() is a GNU extension.
> > 
> > I propose another patch to avoid unprintable characters in output.
> 
> Thanks for your reply.  I agree that the patch you posted is much
> cleaner than mine, however, I think that there is one small problem with
> it.  By simply calling printstr, the path in the sockaddr struct will
> get truncated as if it were data (like the data shown for read syscalls)
> according to the size of the '-s' argument, ie 32 by default.
> 
> In most cases however this path will be a genuine path to a file, and
> the current code in CVS will print this in full, which is consistent
> with how paths are handled elsewhere.

That is, you suggest to use printpathn() instead?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20070926/55fee17f/attachment.bin>


More information about the Strace-devel mailing list