[PATCH] lsof: correct check for symbolic link

Laurent Bercot ska-dietlibc at skarnet.org
Wed Jun 19 17:05:25 UTC 2013


>> 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.


> 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 ?

-- 
 Laurent


More information about the busybox mailing list