busybox/procps
Thomas De Schampheleire 879f008a8f lsof: correct check for symbolic link
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.

The explicit check for a symbolic link is really only needed to skip the
default directory entries '.' and '..'. The directory /proc/<pid>/fd/
should not contain anything else but these two and symbolic links.
With these assumptions, this patch replaces the explicit link check with a
basic check for '.' and '..' (and any hidden file). In the unlikely case that
there are other file types, xmalloc_readlink() will return NULL, and we can
skip the entry.

[1] A MIPS-based board with glibc 2.9, Linux 2.6.32.27.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27 03:44:46 +02:00
..
Config.src top: implement scrolling up/down (_very_ useful) 2012-09-21 13:04:37 +02:00
free.c *: work around sysinfo.h versus linux/*.h problems 2011-07-26 13:42:12 +02:00
fuser.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
iostat.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
Kbuild.src nmeter: deprecate %NNNd specified, use -d MSEC instead 2010-12-13 15:17:22 +01:00
kill.c killall5: don't do STOP/CONT dance if the signal we send is SIGSTOP or SIGCONT 2012-04-03 08:16:05 +02:00
lsof.c lsof: correct check for symbolic link 2013-06-27 03:44:46 +02:00
mpstat.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
nmeter.c whitespace cleanup. no code changes 2013-01-14 15:57:44 +01:00
pgrep.c pgrep: fix a "missing closing paren" build error 2013-02-28 15:51:55 +01:00
pidof.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
pmap.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
powertop.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
ps.c ps: seconds_since_boot: uint64_t -> ulong 2013-01-26 14:21:15 +01:00
ps.posix
pstree.c pstree: stop truncating thread names 2013-06-19 11:29:57 -04:00
pwdx.c pwdx: new applet 2011-03-12 18:13:15 +01:00
renice.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
smemcap.c rename archive.h to bb_archive.h. no code changes 2011-09-22 12:45:14 +02:00
sysctl.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
top.c *: reuse more strings 2013-01-22 10:13:52 +01:00
uptime.c uptime: more compatible output 2011-08-10 13:00:04 +02:00
watch.c libbb: introduce and use strftime_[YYYYMMDD]HHMMSS() 2013-03-29 12:30:33 +01:00