md5/sha512: a better fix for strict aliasing warnings

The locations *are* well-aligned for direct stores
on any architecture.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
nslookup: set default DNS server again. Hopefully helps with 675

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
ubimkvol: add -m option to create volume of maximum size

Signed-off-by: Paul B. Henson <henson@acm.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ubi_tools: extend supported volume size to 64 bits; shrink code

function                                             old     new   delta
get_num_from_file                                      -      90     +90
packed_usage                                       29395   29377     -18
ubi_tools_main                                      1349    1141    -208
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 90/-226)          Total: -136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ubi_tools: add forgotten argv++

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ubi_tools: enhance -s option to allow size multiplier to match mtd-utils

Based on patch by Paul B. Henson <henson@acm.org>

function                                             old     new   delta
static.size_suffixes                                   -      32     +32
ubi_tools_main                                      1141    1148      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
*: change execl sentinels from NULL to (char*)0

Signed-off-by: Rich Felker <dalias@aerifal.cx>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
cryptpw: do not segfault on EOF. Closes 6350

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
wget: do not abort if "_" is encountered in a HTTP header

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
unicode: check $LC_ALL to detect Unicode mode, not only $LANG

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
foo*sum: report I/O errors, don't merely exit with 1.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
tail: track file size only in -f mode

This eliminates extra fstat and lseek calls on every read

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
foo*sum: Correct syntax error

coreutils/md5_sha1_sum.c:156:3: error: expected '}' before 'else'

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
unicode: check $LC_CTYPE too to detect Unicode mode

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Call setlocale("") , not "C", if we want to set the default one

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