[PATCH] lsof: correct check for symbolic link
Mike Frysinger
vapier at gentoo.org
Wed Jun 19 22:06:55 UTC 2013
On Wednesday 19 June 2013 13:05:25 Laurent Bercot wrote:
> >> Busybox lsof used the d_type field of a 'struct dirent' to verify
> >> whether the entry is a symbolic link. This field, however, is not
> >> portable. On at least one board [1] I have seen, that field is 0, and
> >> the check fails even though the entry is a link.
> >
> > most likely your C library needs updating
>
> According to Single Unix v4:
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
> the only guaranteed fields on a struct dirent are d_ino and d_name.
>
> Until a new release of Single Unix comes out, no libc can be expected
> to use d_type, which is duplicated information anyway.
yes, but that's not what he is complaining about
> > not sure if trying to define a build-time knob to control it would work
> > out well since a number of factors come into play here ...
>
> A build-time system check sounds indeed like the right thing to do. What
> kind of factors do you think would make it difficult ?
its existence does not guarantee it will be correctly populated. in his case,
he's seeing DT_UNKNOWN in the field which means the lstat fallback is needed.
-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/20130619/722e256f/attachment.asc>
More information about the busybox
mailing list