trylink: only prefix libs with -l

If our pkg-config queries pass back a flag like -pthread, the trylink
script will expand that to -l-pthread.  So change trylink to only add
the -l prefix to a value that doesn't have a - prefix already.

Reported-by: thaehaid@incognitomail.org
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
wall: access FILE under real user's credentials

While at it, move applet/config/kbuild bits into wall.c.
(This way, it's more visible that applet is suid'ed).

function                                             old     new   delta
wall_main                                             87     138     +51

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
bunzip2: fix off-by-one check

stage3-armv7a_hardfp-20130209.tar.bz2, 149189948 bytes long,
md5sum b29ce23312e14eb15a143377d4a38473, was failing to unpack.

It so happened that this file has a run which exactly fills
the 90k buffer. The check was "size >= bufsize", apparently
it has to be ">".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb: Add xsetegid(), xseteuid(), xopen_as_uid_gid() functions

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
wall,crontab: use xopen_as_uid_gid()

This fixes a narrow security race in crontab.

function                                             old     new   delta
xopen_as_uid_gid                                       -      80     +80
seteuid                                                -      64     +64
setegid                                                -      64     +64
setreuid                                               -      37     +37
xseteuid                                               -      22     +22
xsetegid                                               -      22     +22
crontab_main                                         590     577     -13
setfsuid                                              33       -     -33
setfsgid                                              33       -     -33
wall_main                                            138     102     -36
open_as_user                                         109       -    -109

   text    data     bss     dec     hex filename
 893539     497    7568  901604   dc1e4 busybox_old
 893618     497    7568  901683   dc233 busybox_unstripped

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
awk: fix length(array)

function                                             old     new   delta
evaluate                                            3526    3548     +22

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
init: better --help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
wget: add support for connect timeout

function                                             old     new   delta
open_socket                                           33      64     +31
wget_main                                           2182    2194     +12

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ether-wake: shorten help text, reduce packet buffer size

function                                             old     new   delta
ether_wake_main                                      726     727      +1
packed_usage                                       29468   29434     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Fix some compiler warnings emitted by gcc-4.8.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
wget: if FEATURE_CLEAN_UP, free(ptr_to_globals)

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
tail compat: fix header printing for tail -f

Makes tail -f for multiple files display the header only if another (ie. not
currently displayed) file changed.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
bloat-o-meter: add usage info

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb: use <poll.h> instead of <sys/poll.h>

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
udhcpc: make DHCP packets to have at least 300 DHCP bytes

Commit b8b72f02 removed all padding from DHCP packets
to fix operation with buggy servers which can't handle
maximum sized packets.  But it introduced a regression
with buggy routers which drop DHCP packets smaller
than 300 bytes (i.e. 342 byte ethernet packets).
Add back some padding to work around.

function                                             old     new   delta
udhcp_send_kernel_packet                             268     292     +24
udhcp_send_raw_packet                                462     473     +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sed: accept -E as a synonym for -r

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sed: fix memory leak in 'r FILE' command

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sed: document -E in help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sed: fix "sed clusternewline" testcase

function                                             old     new   delta
process_files                                       2197    2226     +29
flush_append                                          47      54      +7
get_next_line                                        184     189      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Makefile.custom: make "make release" delete .gitignore files too

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>