oweals/busybox.git
11 years agolibbb: code shrink
Denys Vlasenko [Mon, 5 Aug 2013 22:41:06 +0000 (00:41 +0200)]
libbb: code shrink

function                                             old     new   delta
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: tweak help text
Denys Vlasenko [Mon, 5 Aug 2013 00:21:36 +0000 (02:21 +0200)]
udhcpc: tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: use _PATH_LOG when available
Cédric Cabessa [Mon, 5 Aug 2013 00:09:16 +0000 (02:09 +0200)]
syslogd: use _PATH_LOG when available

Signed-off-by: Cédric Cabessa <ccabessa@genymobile.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoubi_tools: fix typo in strcpy
Paul B. Henson [Sun, 4 Aug 2013 19:07:20 +0000 (21:07 +0200)]
ubi_tools: fix typo in strcpy

Signed-off-by: Paul B. Henson <henson@acm.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoifplugd: use a larger netlink buffer
Tito Ragusa [Sun, 4 Aug 2013 16:08:40 +0000 (18:08 +0200)]
ifplugd: use a larger netlink buffer

function                                             old     new   delta
check_existence_through_netlink                      310     321     +11

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoless: support "less 1<>TTY"
Denys Vlasenko [Sun, 4 Aug 2013 15:41:19 +0000 (17:41 +0200)]
less: support "less 1<>TTY"

function                                             old     new   delta
less_main                                           2466    2507     +41
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: add f2fs detection
Sven-Göran Bergh [Thu, 1 Aug 2013 09:05:08 +0000 (11:05 +0200)]
volume_id: add f2fs detection

function                                             old     new   delta
volume_id_probe_f2fs                                   -      98     +98

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: Fix handling of functions with empty body
Bernhard Reutner-Fischer [Wed, 31 Jul 2013 13:29:20 +0000 (15:29 +0200)]
awk: Fix handling of functions with empty body

ammend b79a0fef99627c457548e804fcd6e162b116cbe8 to properly
handle functions defined in another scope.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agovolume_id: nilfs config description.
Sven-Göran Bergh [Wed, 31 Jul 2013 16:30:34 +0000 (18:30 +0200)]
volume_id: nilfs config description.

Config description for nilfs added.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: Adopt to new config style.
Sven-Göran Bergh [Wed, 31 Jul 2013 13:57:59 +0000 (15:57 +0200)]
volume_id: Adopt to new config style.

Config instructions for util-linux/volume_id are moved into the
source files according to the new config feature.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: Adopt to new kbuild style.
Sven-Göran Bergh [Wed, 31 Jul 2013 13:45:20 +0000 (15:45 +0200)]
volume_id: Adopt to new kbuild style.

Kbuild instructions for util-linux/volume_id are moved into the
source files according to the new build feature.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoWhitespace fixes
Denys Vlasenko [Tue, 30 Jul 2013 09:52:58 +0000 (11:52 +0200)]
Whitespace fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocatv: code shrink
Denys Vlasenko [Tue, 30 Jul 2013 09:41:58 +0000 (11:41 +0200)]
catv: code shrink

catv_main                                            250     227     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoRefactor catv. Move visible() from stty to libbb.
Bartosz Golaszewski [Tue, 30 Jul 2013 04:29:42 +0000 (06:29 +0200)]
Refactor catv. Move visible() from stty to libbb.

Fixes the following TODO:

  stty's visible() function and catv's guts are identical. Merge them into
  an appropriate libbb function.

Also makes catv behave exactly like coreutils' cat -v e.g. it'll print 'M-^I'
instead of 'M-   '.

function                                             old     new   delta
visible                                                -      70     +70
do_display                                           431     379     -52
catv_main                                            306     250     -56
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 70/-108)           Total: -38 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounpackers: by users' request, print compression percentage if -v and DESKTOP
Denys Vlasenko [Tue, 30 Jul 2013 03:41:11 +0000 (05:41 +0200)]
unpackers: by users' request, print compression percentage if -v and DESKTOP

function                                             old     new   delta
bbunpack                                             634     731     +97

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: remove unnecessary "errno = 0"
Denys Vlasenko [Mon, 29 Jul 2013 12:18:32 +0000 (14:18 +0200)]
nc: remove unnecessary "errno = 0"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoiplink: fix build error (IFLA_VLAN_PROTOCOL defined before include)
Denys Vlasenko [Sun, 28 Jul 2013 21:24:55 +0000 (23:24 +0200)]
iplink: fix build error (IFLA_VLAN_PROTOCOL defined before include)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agologread: intercept all fatal signals, not just SIGINT
Denys Vlasenko [Sun, 28 Jul 2013 21:17:00 +0000 (23:17 +0200)]
logread: intercept all fatal signals, not just SIGINT

function                                             old     new   delta
interrupted                                           27      20      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: remove some dead code
Denys Vlasenko [Sun, 28 Jul 2013 20:24:51 +0000 (22:24 +0200)]
nc: remove some dead code

function                                             old     new   delta
readwrite                                            887     841     -46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: exit when both stdin and network are closed.
Denys Vlasenko [Sun, 28 Jul 2013 20:23:12 +0000 (22:23 +0200)]
nc: exit when both stdin and network are closed.

function                                             old     new   delta
nc_main                                             1051    1042      -9
readwrite                                            943     887     -56

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: use symbolic SHUT_WR instead of literal 1
Denys Vlasenko [Sun, 28 Jul 2013 19:08:37 +0000 (21:08 +0200)]
nc: use symbolic SHUT_WR instead of literal 1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoUpdate docs/tcp.txt
Denys Vlasenko [Sat, 27 Jul 2013 12:35:51 +0000 (14:35 +0200)]
Update docs/tcp.txt

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agobuildsys: Add helper to list suid applets
Bernhard Reutner-Fischer [Mon, 10 Jun 2013 15:08:22 +0000 (17:08 +0200)]
buildsys: Add helper to list suid applets

Add a helper script that lists all applets that
- do or may require SUID provileges (busybox.cfg.suid)
- do not require SUID provileges (busybox.cfg.nosuid)

Some setups prefer to build two busybox binaries, one that is suid which
contains all applets that do or may require suid privileges, and a
second one for all the rest (which drops suid). To ease splitting these
two binaries, generate a list of CONFIG_ items for the suid binary.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agoAdd notes about TCP programming quirks.
Denys Vlasenko [Thu, 25 Jul 2013 12:00:37 +0000 (14:00 +0200)]
Add notes about TCP programming quirks.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodate: accept 'yyyy-mm-dd HH' and 'yyyy-mm-dd' date formats
Bartosz Golaszewski [Thu, 25 Jul 2013 02:59:46 +0000 (04:59 +0200)]
date: accept 'yyyy-mm-dd HH' and 'yyyy-mm-dd' date formats

function                                             old     new   delta
parse_datestr                                        794     885     +91

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonetworking: code shrink
Bartosz Golaszewski [Thu, 25 Jul 2013 02:39:04 +0000 (04:39 +0200)]
networking: code shrink

function                                             old     new   delta
in_ether                                               -     124    +124
hexchar2int                                           42       -     -42
ifconfig_main                                       1237    1106    -131
ether_input                                          141       -    -141
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/1 up/down: 124/-314)         Total: -190 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk.tests: add test for recent large integer fix
Denys Vlasenko [Mon, 22 Jul 2013 09:49:06 +0000 (11:49 +0200)]
awk.tests: add test for recent large integer fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: fix matching of newlines by $
Denys Vlasenko [Sun, 21 Jul 2013 20:09:44 +0000 (22:09 +0200)]
sed: fix matching of newlines by $

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounzip: survive lack of CDF on non-streaming zip files
Denys Vlasenko [Sun, 21 Jul 2013 00:31:08 +0000 (02:31 +0200)]
unzip: survive lack of CDF on non-streaming zip files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: use "long long" as integer type, not "int"
Denys Vlasenko [Sat, 20 Jul 2013 19:23:01 +0000 (21:23 +0200)]
awk: use "long long" as integer type, not "int"

Testcase:
awk "BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"
2147483647 2147483647 0 2147483648 2147483648 0

(last three values weren't showing right)

function                                             old     new   delta
evaluate                                            3444    3458     +14
fmt_num                                              221     230      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounzip: increase PEEK_FROM_END from 16k to 64k
Denys Vlasenko [Sat, 20 Jul 2013 13:20:46 +0000 (15:20 +0200)]
unzip: increase PEEK_FROM_END from 16k to 64k

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoip link: add VLAN support
Patrick McHardy [Mon, 15 Jul 2013 03:16:13 +0000 (05:16 +0200)]
ip link: add VLAN support

function                                             old     new   delta
do_add_or_delete                                       -    1073   +1073
get_u16                                                -      62     +62
static.protocols                                       -      16     +16
do_iplink                                           1235    1232      -3
do_change                                            495       -    -495
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/1 up/down: 1151/-498)         Total: 653 bytes

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoip: code shrink
Denys Vlasenko [Mon, 15 Jul 2013 03:15:46 +0000 (05:15 +0200)]
ip: code shrink

function                                             old     new   delta
do_ipaddr                                             78      81      +3
do_iprule                                            140     139      -1
do_iptunnel                                          283     278      -5
iprule_modify                                        851     841     -10
ipaddr_modify                                       1293    1236     -57
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 3/-73)             Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotypo fix in comment
Denys Vlasenko [Sat, 13 Jul 2013 23:23:06 +0000 (01:23 +0200)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoCommonalize typical [b,]k,m suffix struct
Denys Vlasenko [Sat, 13 Jul 2013 21:49:45 +0000 (23:49 +0200)]
Commonalize typical [b,]k,m suffix struct

function                                             old     new   delta
bkm_suffixes                                           -      32     +32
static.km_suffixes                                    24       -     -24
suffixes                                              32       -     -32
static.bkm                                            32       -     -32
head_tail_suffixes                                    32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160)           Total: -88 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agochrt: remove warning for _POSIX_PRIORITY_SCHEDULING
Bernhard Reutner-Fischer [Mon, 8 Jul 2013 09:20:13 +0000 (11:20 +0200)]
chrt: remove warning for _POSIX_PRIORITY_SCHEDULING

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agotypo fix in comment
Denys Vlasenko [Mon, 8 Jul 2013 01:13:08 +0000 (03:13 +0200)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotail: code shrink
Denys Vlasenko [Mon, 8 Jul 2013 00:39:51 +0000 (02:39 +0200)]
tail: code shrink

function                                             old     new   delta
tail_main                                           1548    1613     +65
tail_read                                            136      34    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 65/-102)           Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: remove now-redundant backslash-newline handling
Denys Vlasenko [Mon, 8 Jul 2013 00:04:44 +0000 (02:04 +0200)]
sed: remove now-redundant backslash-newline handling

4b0bb9e0fd9ec06e9e61b1a1527ace99ea9fe571 added this code in 2007,
then in a2215b98f7d65bc613b9c8f008d79672402c6a07 more general fix
was added.

function                                             old     new   delta
add_cmd_block                                         98      58     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: document where we are more liberal then GNU
Denys Vlasenko [Sun, 7 Jul 2013 23:43:40 +0000 (01:43 +0200)]
sed: document where we are more liberal then GNU

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoCall setlocale("") , not "C", if we want to set the default one
Denys Vlasenko [Sun, 7 Jul 2013 12:41:58 +0000 (14:41 +0200)]
Call setlocale("") , not "C", if we want to set the default one

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounicode: check $LC_CTYPE too to detect Unicode mode
Denys Vlasenko [Fri, 5 Jul 2013 20:00:57 +0000 (22:00 +0200)]
unicode: check $LC_CTYPE too to detect Unicode mode

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofoo*sum: Correct syntax error
Cristian Ionescu-Idbohrn [Wed, 3 Jul 2013 17:03:37 +0000 (19:03 +0200)]
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>
11 years agotail: track file size only in -f mode
Denys Vlasenko [Tue, 2 Jul 2013 18:09:15 +0000 (20:09 +0200)]
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>
11 years agofoo*sum: report I/O errors, don't merely exit with 1.
Denys Vlasenko [Tue, 2 Jul 2013 17:11:01 +0000 (19:11 +0200)]
foo*sum: report I/O errors, don't merely exit with 1.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounicode: check $LC_ALL to detect Unicode mode, not only $LANG
Denys Vlasenko [Tue, 2 Jul 2013 15:30:23 +0000 (17:30 +0200)]
unicode: check $LC_ALL to detect Unicode mode, not only $LANG

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowget: do not abort if "_" is encountered in a HTTP header
Denys Vlasenko [Mon, 1 Jul 2013 13:01:50 +0000 (15:01 +0200)]
wget: do not abort if "_" is encountered in a HTTP header

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocryptpw: do not segfault on EOF. Closes 6350
Denys Vlasenko [Sun, 30 Jun 2013 19:28:55 +0000 (21:28 +0200)]
cryptpw: do not segfault on EOF. Closes 6350

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years ago*: change execl sentinels from NULL to (char*)0
Rich Felker [Sun, 30 Jun 2013 11:45:17 +0000 (13:45 +0200)]
*: 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>
11 years agoubi_tools: enhance -s option to allow size multiplier to match mtd-utils
Denys Vlasenko [Sun, 30 Jun 2013 00:47:45 +0000 (02:47 +0200)]
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>
11 years agoubi_tools: add forgotten argv++
Denys Vlasenko [Sun, 30 Jun 2013 00:46:44 +0000 (02:46 +0200)]
ubi_tools: add forgotten argv++

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoubi_tools: extend supported volume size to 64 bits; shrink code
Denys Vlasenko [Sun, 30 Jun 2013 00:38:18 +0000 (02:38 +0200)]
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>
11 years agoubimkvol: add -m option to create volume of maximum size
Paul B. Henson [Mon, 3 Jun 2013 00:48:05 +0000 (17:48 -0700)]
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>
11 years agopstree: fix theoretically unsafe code
Denys Vlasenko [Thu, 27 Jun 2013 23:59:25 +0000 (01:59 +0200)]
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>
11 years agoping: code shrink
Denys Vlasenko [Thu, 27 Jun 2013 23:33:47 +0000 (01:33 +0200)]
ping: code shrink

function                                             old     new   delta
unpack_tail                                          262     243     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoMove create_icmp[6]_socket to its only user, and simplify it
Denys Vlasenko [Thu, 27 Jun 2013 22:30:46 +0000 (00:30 +0200)]
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>
11 years agolosetup: assorted fixes. Closes 6314
Denys Vlasenko [Thu, 27 Jun 2013 01:45:16 +0000 (03:45 +0200)]
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>
11 years agolsof: correct check for symbolic link
Thomas De Schampheleire [Fri, 21 Jun 2013 19:27:56 +0000 (21:27 +0200)]
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>
11 years agonslookup: set default DNS server again. Hopefully helps with 675
Denys Vlasenko [Wed, 26 Jun 2013 23:09:51 +0000 (01:09 +0200)]
nslookup: set default DNS server again. Hopefully helps with 675

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomd5/sha512: a better fix for strict aliasing warnings
Denys Vlasenko [Wed, 26 Jun 2013 23:03:19 +0000 (01:03 +0200)]
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>
11 years agomd5/sha512: fix strict aliasing warnings
Mike Frysinger [Wed, 19 Jun 2013 15:45:05 +0000 (11:45 -0400)]
md5/sha512: fix strict aliasing warnings

If the target can tolerate these issues, then gcc is smart enough
to generate the same code (x86_64 produces the same code).  If the
target can't, then it needs the memcpy anyways.

libbb/hash_md5_sha.c: In function 'common64_end':
libbb/hash_md5_sha.c:87:4: warning:
  dereferencing type-punned pointer will break strict-aliasing rules
    *(uint64_t *) (&ctx->wbuffer[64 - 8]) = t;
libbb/hash_md5_sha.c: In function 'sha512_end':
libbb/hash_md5_sha.c:886:4: warning:
  dereferencing type-punned pointer will break strict-aliasing rules
    *(uint64_t *) (&ctx->wbuffer[128 - 8]) = t;
libbb/hash_md5_sha.c:889:4: warning:
  dereferencing type-punned pointer will break strict-aliasing rules
    *(uint64_t *) (&ctx->wbuffer[128 - 16]) = t;

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agopstree: stop truncating thread names
Mike Frysinger [Wed, 19 Jun 2013 15:29:57 +0000 (11:29 -0400)]
pstree: stop truncating thread names

This also fixes a minor buffer overflow when displaying threads as
add_proc() only expects COMM_LEN bytes, but we give it one more than
that.

Reported-by: Dag Wieers <dag@wieers.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agontpd: set offset to 0.0 in "usync" event
Denys Vlasenko [Thu, 23 May 2013 14:06:59 +0000 (16:06 +0200)]
ntpd: set offset to 0.0 in "usync" event

function                                             old     new   delta
ntpd_main                                           1030    1026      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agontpd: set G.last_script_run even if script isn't configured
Denys Vlasenko [Wed, 22 May 2013 16:18:51 +0000 (18:18 +0200)]
ntpd: set G.last_script_run even if script isn't configured

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agontpd: make "unsync" code actually work.
Denys Vlasenko [Wed, 22 May 2013 16:16:34 +0000 (18:16 +0200)]
ntpd: make "unsync" code actually work.

While at it: don't run "periodic" if interrupted by a signal.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agontpd: drop delay outliers; run "unsync" handler if no replies for some time
Denys Vlasenko [Wed, 22 May 2013 15:48:19 +0000 (17:48 +0200)]
ntpd: drop delay outliers; run "unsync" handler if no replies for some time

function                                             old     new   delta
ntpd_main                                            960    1029     +69
recv_and_process_peer_pkt                            834     892     +58
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 127/0)             Total: 127 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosulogin: allow system maintenance login if root password is empty
Jonathan Liu [Tue, 21 May 2013 15:01:55 +0000 (17:01 +0200)]
sulogin: allow system maintenance login if root password is empty

The current password checking is unable to distinguish between the user
entering an empty password or pressing Control-D. As a result, an empty
password always results in normal startup.

We modify bb_ask to return NULL if Control-D is pressed without entering
a password. The sulogin applet is then modified to only proceed to
normal startup if bb_ask returns NULL. This covers EOF with no password,
interrupt by timeout and ^C.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosulogin: correct lying comment
Denys Vlasenko [Tue, 21 May 2013 14:47:36 +0000 (16:47 +0200)]
sulogin: correct lying comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoinit: remove special-case code for machines with less tham 1 MB of RAM.
Denys Vlasenko [Tue, 21 May 2013 14:36:51 +0000 (16:36 +0200)]
init: remove special-case code for machines with less tham 1 MB of RAM.

function                                             old     new   delta
init_main                                            920     781    -139

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agostty: disable CIBAUD leak check - it is not necessary on Linux
Denys Vlasenko [Fri, 17 May 2013 18:08:12 +0000 (20:08 +0200)]
stty: disable CIBAUD leak check - it is not necessary on Linux

function                                             old     new   delta
stty_main                                           1233    1196     -37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agostty: code shrink
Denys Vlasenko [Fri, 17 May 2013 16:06:49 +0000 (18:06 +0200)]
stty: code shrink

function                                             old     new   delta
set_mode                                             759     725     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcp: code shrink
Denys Vlasenko [Fri, 17 May 2013 13:19:47 +0000 (15:19 +0200)]
udhcp: code shrink

function                                             old     new   delta
attach_option                                        416     413      -3
allocate_tempopt_if_needed                            74       -     -74

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: fix a problem with binary-encoded options #2
Denys Vlasenko [Fri, 17 May 2013 13:13:38 +0000 (15:13 +0200)]
udhcpc: fix a problem with binary-encoded options #2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofind:: get rid of nested function (it's a gcc-ism)
Denys Vlasenko [Thu, 16 May 2013 16:36:42 +0000 (18:36 +0200)]
find:: get rid of nested function (it's a gcc-ism)

function                                             old     new   delta
alloc_action                                           -      80     +80
parse_params                                        1459    1445     -14
static.alloc_action                                   98       -     -98
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 80/-112)           Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agogrep: fix grep -x to not set REG_NOSUB
James Hogan [Tue, 7 May 2013 11:32:21 +0000 (12:32 +0100)]
grep: fix grep -x to not set REG_NOSUB

When -F isn't specified (and !ENABLE_EXTRA_COMPAT), grep -x uses
regexec's regmatch_t output to determine if the match was the entire
line. However it also set the REG_NOSUB flag which makes it ignore the
regmatch_t argument.

Add an exception to the setting of REG_NOSUB for OPT_x and add some test
cases to test the behaviour of -x.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Natanael Copa <ncopa@alpinelinux.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id_internal.h: drop unoptimized byteswap routines
Denys Vlasenko [Wed, 15 May 2013 07:36:40 +0000 (09:36 +0200)]
volume_id_internal.h: drop unoptimized byteswap routines

function                                             old     new   delta
volume_id_probe_hfs_hfsplus                          802     627    -175

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agogrep: don't bail out on first mismatch if '-w' option is set
Bartosz Golaszewski [Wed, 15 May 2013 01:53:26 +0000 (03:53 +0200)]
grep: don't bail out on first mismatch if '-w' option is set

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoFix build failures caused by not compiling open_transformer.c (#2)
Denys Vlasenko [Wed, 15 May 2013 01:23:30 +0000 (03:23 +0200)]
Fix build failures caused by not compiling open_transformer.c (#2)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofind: support -HLP
Denys Vlasenko [Tue, 14 May 2013 15:20:35 +0000 (17:20 +0200)]
find: support -HLP

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: use $DEVNAME in uevent sysfs file for device node name
Nikolaus Voss [Mon, 13 May 2013 01:55:11 +0000 (03:55 +0200)]
mdev: use $DEVNAME in uevent sysfs file for device node name

516530c932bd17d87c9eb4347a490be051e495f4 uses $DEVNAME variable
for device node name. This is fine, but only works for hotplugging,
"mdev -s" will behave differently when DEVNAME and basename(path)
differ.

This patch extracts the DEVNAME from the uevent sysfs file in
make_device(), thus works for hot- and coldplugging; so using
the environment DEVNAME on hotplug events is no longer necessary.

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohush: fix build failure if FEATURE_EDITING=y && !HUSH_INTERACTIVE
Denys Vlasenko [Sun, 12 May 2013 00:45:23 +0000 (02:45 +0200)]
hush: fix build failure if FEATURE_EDITING=y && !HUSH_INTERACTIVE

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoFix build failures caused by not compiling open_transformer.c
Denys Vlasenko [Sun, 12 May 2013 00:34:38 +0000 (02:34 +0200)]
Fix build failures caused by not compiling open_transformer.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotelnet: code shrink
Denys Vlasenko [Sun, 12 May 2013 00:13:24 +0000 (02:13 +0200)]
telnet: code shrink

function                                             old     new   delta
telnet_main                                         1519    1515      -4
con_escape                                           296     285     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: fix ntfs attribute search
Oliver Metz [Wed, 8 May 2013 18:21:29 +0000 (20:21 +0200)]
volume_id: fix ntfs attribute search

len is declared as uint32_t but le16_to_cpu macro is used

Signed-off-by: Oliver Metz <oliver.metz@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovi: make regexp search case-insensitive if ":set ignorecase" is active
Denys Vlasenko [Sun, 21 Apr 2013 13:51:41 +0000 (15:51 +0200)]
vi: make regexp search case-insensitive if ":set ignorecase" is active

Reported by Dan Moinescu <dan@moinescu.net>.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash,hush: history builtin
Flemming Madsen [Sun, 7 Apr 2013 16:47:24 +0000 (18:47 +0200)]
ash,hush: history builtin

function                                             old     new   delta
show_history                                           -      39     +39
builtin_history                                        -      16     +16
historycmd                                             -      13     +13
bltins1                                              312     324     +12
builtintab                                           336     344      +8
popstring                                            134     140      +6
hush_main                                           1048    1046      -2
ash_main                                            1398    1396      -2
size_from_HISTFILESIZE                                44      40      -4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 3/3 up/down: 94/-8)              Total: 86 bytes

Signed-off-by: Flemming Madsen <busybox@themadsens.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohush: fix for "while false && true; do echo BUG; break; done". closes 6170
Denys Vlasenko [Sun, 7 Apr 2013 16:16:58 +0000 (18:16 +0200)]
hush: fix for "while false && true; do echo BUG; break; done". closes 6170

function                                             old     new   delta
run_list                                             959     941     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: call index_in_strings on $ACTION only after we checked it for NULL
Denys Vlasenko [Tue, 2 Apr 2013 12:37:06 +0000 (14:37 +0200)]
mdev: call index_in_strings on $ACTION only after we checked it for NULL

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoexamples/mdev.conf.change_blockdev.sh: update
Denys Vlasenko [Tue, 2 Apr 2013 11:26:24 +0000 (13:26 +0200)]
examples/mdev.conf.change_blockdev.sh: update

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoexamples: add mdev example for Android phone
Denys Vlasenko [Sat, 30 Mar 2013 15:23:12 +0000 (16:23 +0100)]
examples: add mdev example for Android phone

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoexamples/inittab: fix a few incorrect statements about init
Denys Vlasenko [Fri, 29 Mar 2013 13:35:44 +0000 (14:35 +0100)]
examples/inittab: fix a few incorrect statements about init

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: \W on "/bin" should show "bin", not "/bin"
Denys Vlasenko [Fri, 29 Mar 2013 12:21:53 +0000 (13:21 +0100)]
lineedit: \W on "/bin" should show "bin", not "/bin"

function                                             old     new   delta
parse_and_put_prompt                                 793     785      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: implement \T \t \A \@ prompts escapes, fix \W escape, drop \!
Denys Vlasenko [Fri, 29 Mar 2013 12:09:05 +0000 (13:09 +0100)]
lineedit: implement \T \t \A \@ prompts escapes, fix \W escape, drop \!

function                                             old     new   delta
parse_and_put_prompt                                 742     793     +51
read_line_input                                     3836    3826     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolibbb: introduce and use strftime_[YYYYMMDD]HHMMSS()
Denys Vlasenko [Fri, 29 Mar 2013 11:30:33 +0000 (12:30 +0100)]
libbb: introduce and use strftime_[YYYYMMDD]HHMMSS()

function                                             old     new   delta
strftime_fmt                                           -      53     +53
strftime_YYYYMMDDHHMMSS                                -      12     +12
strftime_HHMMSS                                        -      12     +12
human_time                                            44      43      -1
fmtstr_t                                               9       -      -9
step_time                                            361     345     -16
watch_main                                           261     232     -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/3 up/down: 77/-55)             Total: 22 bytes
   text    data     bss     dec     hex filename
 919203     932   17692  937827   e4f63 busybox_old
 919209     932   17692  937833   e4f69 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: add handling of \H in prompt
Denys Vlasenko [Thu, 28 Mar 2013 12:20:12 +0000 (13:20 +0100)]
lineedit: add handling of \H in prompt

Based on the patch by Arnaud Rébillout <rebillout@syscom.ch>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohexdump: need to use xstrtoull for off_t
Denys Vlasenko [Wed, 27 Mar 2013 14:18:32 +0000 (15:18 +0100)]
hexdump: need to use xstrtoull for off_t

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohexdump: don't unconditionally limit the usable address range
Denys Vlasenko [Wed, 27 Mar 2013 14:15:33 +0000 (15:15 +0100)]
hexdump: don't unconditionally limit the usable address range

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoman: install to /usr/bin, not /sbin
Denys Vlasenko [Wed, 27 Mar 2013 13:30:18 +0000 (14:30 +0100)]
man: install to /usr/bin, not /sbin

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohttpd: don't allow tabs and multiple spaces in request string
Denys Vlasenko [Mon, 25 Mar 2013 22:27:00 +0000 (23:27 +0100)]
httpd: don't allow tabs and multiple spaces in request string

HTTP standard doesn't allow it and no sane clients should ever use it.

function                                             old     new   delta
handle_incoming_and_exit                            2795    2785     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosetserial: Fix typo: s/baund_rate/baud_rate/g
Bernhard Reutner-Fischer [Fri, 22 Mar 2013 16:04:51 +0000 (17:04 +0100)]
setserial: Fix typo: s/baund_rate/baud_rate/g

as noted by Christoph Handel opensource at macht-blau.org

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>