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>
losetup: assorted fixes. Closes 6314

"losetup -d" was not complaining that LOOPDEV is missing.
"losetup -a" was listing only up to /dev/loop9.
"losetup -f" looped forever if llop0 was taken, and never tried
anything after /dev/loop9.
"-o" with other options (say, -r) had no effect.

function                                             old     new   delta
losetup_main                                         376     419     +43

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Move create_icmp[6]_socket to its only user, and simplify it

function                                             old     new   delta
run_applet_and_exit                                  711     714      +3
sendping_tail                                        239     236      -3
common_ping_main                                    1798    1770     -28
create_icmp_socket                                    65       -     -65
create_icmp6_socket                                   65       -     -65
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 1/2 up/down: 3/-161)           Total: -158 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ping: code shrink

function                                             old     new   delta
unpack_tail                                          262     243     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
pstree: fix theoretically unsafe code

In practice, p->comm is never long enough to trigger the bug, but still.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>