[PATCH v2] lsof: correct check for symbolic link
Mike Frysinger
vapier at gentoo.org
Thu Jun 27 01:33:33 UTC 2013
On Friday 21 June 2013 13:43:28 Rich Felker wrote:
> On Fri, Jun 21, 2013 at 07:36:53PM +0200, Thomas De Schampheleire wrote:
> > > Thanks for the feedback, I just sent a third version.
> > >
> > > For my info: is the check on the symbolic link only present to skip
> > > '.' and '..', or are there situations where /proc/<pid>/fd contains
> > > other entries than symbolic links and the two default directory
> > > entries?
> >
> > If it is only to skip . and .., and if we make an additional
> > assumption that there will not be hidden files in /proc/<pid>/fd, then
>
> > the entire code can be reduced to:
> I think it's a reasonable assumption that /proc/<pid>/fd does not
> contain anything but symbolic links, ., and .., but even if something
> else does exist, readlink will fail with EINVAL. That seems like a
> more reasonable way to detect the unexpected case of something other
> than symlinks being there.
that is a good idea indeed, thanks
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130626/17c2d141/attachment.asc>
More information about the busybox
mailing list