Commit Graph

13215 Commits

Author SHA1 Message Date
Bartosz Golaszewski
28a209466f bloat-o-meter: add usage info
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-16 19:18:05 +02:00
Bartosz Golaszewski
64938011f3 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>
2013-10-16 15:02:50 +02:00
Guilherme Maciel Ferreira
840ef17f63 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>
2013-10-16 14:43:30 +02:00
Denys Vlasenko
5117eff6f9 Fix some compiler warnings emitted by gcc-4.8.0
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-16 14:21:20 +02:00
Denys Vlasenko
eba5faec67 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>
2013-10-14 19:04:20 +02:00
Lauri Kasanen
d074b416f8 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>
2013-10-12 21:47:07 +02:00
Denys Vlasenko
730e4d8b52 init: better --help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 04:52:22 +02:00
Denys Vlasenko
7985bc109e awk: fix length(array)
function                                             old     new   delta
evaluate                                            3526    3548     +22

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 04:51:54 +02:00
Ryan Mallon
1d30b3f1f6 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>
2013-10-08 14:53:29 +02:00
Ryan Mallon
5906a5c26c 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>
2013-10-08 14:52:49 +02:00
Denys Vlasenko
932e233a49 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>
2013-10-06 22:53:14 +02:00
Denys Vlasenko
cd256e1c40 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>
2013-10-06 15:14:25 +02:00
Mike Frysinger
3eab2b7675 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>
2013-09-28 18:40:07 -04:00
Denys Vlasenko
054f3eb784 loadkmap: explain what happens with K_ALLOCATED key value
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-19 17:56:59 +02:00
Denys Vlasenko
a6ed6a3148 httpd: make sire pfd[TO_CGI].revents is cleared before poll()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-18 12:08:41 +02:00
Denys Vlasenko
d7ea34ee71 Documentation update
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-17 16:24:01 +02:00
Denys Vlasenko
32ed30d96b dumpkmap: code shrink
function                                             old     new   delta
dumpkmap_main                                        223     160     -63

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-17 14:16:25 +02:00
Denys Vlasenko
fbe250db76 httpd: treat errors from stdin correctly.
Fron bug report:

If a CGI or proxied connection is rudely aborted (SIG_{KILL,BUS,SEGV})
then httpd will spin madly the poll loop in:

networking/httpd.c:1080
cgi_io_loop_and_exit()

Upon investigation I found that pfd[0].revents == 0x0018 (POLLHUP|POLLERR),
which leads to empty read, but the pfd[0].fd (STDIN_FILENO) is left open,
and in the FD list given to poll() which immediately returns to once
again inform the loop of (POLLHUP|POLLERR) condition of pfd[0].fd.
This continues until pfd[FROM_CGI].revents != 0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-11 14:59:21 +02:00
Denys Vlasenko
b5352078a7 touch: add conditional support for -h
Based on a patch by Andy <andy.padavan@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-11 11:58:33 +02:00
Denys Vlasenko
a613aa1b4c ar: better comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-10 16:27:08 +02:00
Peter Korsgaard
2a053a2430 ar: read_num(): fix reading fields using the entire width
ar fields are fixed length text strings (padded with spaces). Ensure
bb_strtou doesn't read past the field in case the full width is used.

The fields are only read once, so the simplest/smallest solution to me
seems to be to just pass the length to read_num() and then zero terminate
the string before passing it to bb_strtou. This does mean that the fields
MUST be read in reverse order, so some minor reshuffling was needed.

Bloat-o-meter:
function                                             old     new   delta
get_header_ar                                        394     414     +20
read_num                                              29      36      +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-10 16:22:12 +02:00
Denys Vlasenko
dc57294485 top: fix breakage introduced by previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-06 12:59:48 +02:00
Denys Vlasenko
a407cf74cc Make smart_ulltoa return pointer to end (allows for code shink in callers)
function                                             old     new   delta
smart_ulltoa5                                        405     408      +3
smart_ulltoa4                                        273     276      +3
list_table                                          1113    1114      +1
scale                                                 36      34      -2
put_lu                                                55      53      -2
ulltoa6_and_space                                     19      14      -5
powertop_main                                       1470    1461      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-06 12:53:14 +02:00
John Spencer
d6ae4fb446 man: find posix man pages
Add the 0p/1p/3p sections to the search.

Signed-off-by: John Spencer <maillist-busybox@barfooze.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-08-25 17:38:25 -04:00
Jody Bruchon
deebdf59b5 fdisk: fix GPT size math errors
Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 17:42:06 +02:00
Denys Vlasenko
1b9ac21166 lineedit: use unicode_strwidth instead of unicode_strlen
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 16:13:05 +02:00
Denys Vlasenko
0ff0b320a2 dd: code shrink
function                                             old     new   delta
dd_main                                             1475    1469      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:49:28 +02:00
Denys Vlasenko
1b57fe108f dd: code shrink
function                                             old     new   delta
dd_main                                             1487    1475     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:45:05 +02:00
Denys Vlasenko
f3114a3bd0 dd: code shrink
function                                             old     new   delta
write_and_stats                                       78      99     +21
dd_main                                             1496    1487      -9
full_write_or_warn                                    42       -     -42
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 21/-51)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:40:29 +02:00
Denys Vlasenko
90e9cfd218 dd: remove FIXME comment which is fixed now. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:27:19 +02:00
Denys Vlasenko
4502bb1f21 dd: code shrink
function                                             old     new   delta
dd_main                                             1001     961     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:08:46 +02:00
Denys Vlasenko
5b9910f0a4 dd: fail if swab is attempted on odd-sized block
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 02:50:49 +02:00
Denys Vlasenko
e66a56de23 lineedit: fix multi-line PS1 handling: calculate PS1 length from last \n
function                                             old     new   delta
parse_and_put_prompt                                 755     774     +19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 16:45:04 +02:00
Denys Vlasenko
7a18043a96 lineedit: improve Unicode handling (still buggy though)
function                                             old     new   delta
unicode_strlen                                         -      31     +31
read_line_input                                     3876    3879      +3
lineedit_read_key                                    255     246      -9
parse_and_put_prompt                                 785     755     -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 34/-39)             Total: -5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 16:44:05 +02:00
Denys Vlasenko
8395bd3f52 dd: fix example in a comment. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 10:30:55 +02:00
Denys Vlasenko
b941316ae5 dd: support conv=swab
function                                             old     new   delta
dd_main                                             1482    1520     +38
static.conv_words                                     28      33      +5
packed_usage                                       29377   29375      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 09:01:39 +02:00
Denys Vlasenko
4b1896cd2c dd: do not reuse local variables for unrelated values.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 09:00:08 +02:00
Denys Vlasenko
ec2bef11a7 iplink: comment out include <net/if_packet.h>
iplink.c includes net/if_packet.h, which (on GLIBC)
only defines struct sockaddr_pkt. this struct is not
used anywhere in the code, and removing the #include
makes compilation succeed with musl libc.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16 12:20:25 +02:00
Paulius Zaleckas
9f07af6156 init: don't srop unterminated processes' entries during inittab reload
This feature was removed in 72c99af

It is useful when process is removed from inittab and later added
back, but never terminated. It prevents init from spawning duplicate.

function                                             old     new   delta
check_delayed_sigs                                   176     182      +6

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16 12:01:58 +02:00
Denys Vlasenko
d2e07bc16c init: don't use fixed size buffer for command
We store init actions forever. 256 bytes per action means that
a typical inittab of ~10 commands uses 2.5k just to remember
command strings - which are usually _much_ shorter than 256 bytes.

At a cost of a bit more code, it's possible to allocate
only actually needed amount.

function                                             old     new   delta
init_exec                                            224     248     +24
new_init_action                                      140     142      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16 11:48:48 +02:00
SASAKI Suguru
73fbe9dc86 tar: fix tar -T to add entries in the exact order as the input list
This fixes tar to order files in tarball correctly in this case:

$ touch 1 2 3; echo -e '1\n2\n3' | tar -T- -c | tar t
1
2
3

Signed-off-by: SASAKI Suguru <suguru@sonik.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-15 12:19:29 +02:00
Denys Vlasenko
fc364ba9e3 fix build error with musl libc due to if_slip.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-15 09:54:51 +02:00
Nicolas Dichtel
6761d7da83 networking: fix potential overflow in ife_print6()
devname is used by fscanf to store a string specified by '%20s'.

Extract from the man for the '%s' specifier:
Matches a sequence of non-white-space characters; the next pointer must be a
pointer to character array that is long enough to hold the input sequence and
the terminating null byte ('\0'), which is added automatically. The input
string stops at white space or at the maximum field width, whichever occurs
first.

Hence, the right length is 20 + 1 for the '\0'.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-14 17:43:05 +02:00
Denys Vlasenko
9ae6d79307 udhcpc: tweak help text more
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 12:45:45 +02:00
Denys Vlasenko
456687fff1 udhcpc: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 12:33:18 +02:00
Tito Ragusa
8c7fcbd752 swapon: support "pri=NNN" in fstab
function                                             old     new   delta
swap_on_off_main                                     244     365    +121

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 10:21:27 +02:00
Denys Vlasenko
a5e6c6cd3b setsid: code shrink, expanded comments
function                                             old     new   delta
setsid_main                                           56      53      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-07 18:49:51 +02:00
Denys Vlasenko
543efd7b4b libbb: code shrink
function                                             old     new   delta
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-06 00:41:06 +02:00
Denys Vlasenko
aadb485bd0 udhcpc: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-05 02:21:36 +02:00
Cédric Cabessa
adc30b4cf9 syslogd: use _PATH_LOG when available
Signed-off-by: Cédric Cabessa <ccabessa@genymobile.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-05 02:09:16 +02:00