[PATCH v3] Print absolute paths in printpathn when -yy is used

Mike Frysinger vapier at gentoo.org
Thu Jun 19 00:24:19 UTC 2014


On Wed 18 Jun 2014 04:19:23 Dmitry V. Levin wrote:
> On Mon, Jun 16, 2014 at 10:47:05PM -0400, Mike Frysinger wrote:
> > On Sun 15 Jun 2014 09:14:05 zubin.mithra at gmail.com wrote:
> > > From: Zubin Mithra <zubin.mithra at gmail.com>
> 
> [...]
> 
> > > +	ssize_t n;
> > > +
> > > +	snprintf(linkpath, link_size, "/proc/%u/cwd", tcp->pid);
> > > +	n = readlink(linkpath, cwd, MAXPATHLEN);
> > 
> > anytime you start using magic constant lengths for paths, you know you're
> > probably doing something wrong.  you have to remember that some systems
> > don't have a max path length restriction so these constants won't even be
> > defined.
>
> strace already uses MAXPATHLEN, e.g. in printpath(), so do we really want
> to support /proc/pid/cwd symlinks that are longer than MAXPATHLEN?
> If we do, then it should be implemented via realloc loop.
> If not, then we should handle this very unlikely case of
> readlink(MAXPATHLEN+1) returning a value greater than MAXPATHLEN,
> e.g. by treating it like readlink error.

i think existing cases of MAXPATHLEN should get fixed rather than extended
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140618/7e667d71/attachment.bin>


More information about the Strace-devel mailing list