oweals/busybox.git
9 years agodc: tweak parsing
Bernhard Reutner-Fischer [Mon, 16 Feb 2015 16:12:04 +0000 (17:12 +0100)]
dc: tweak parsing

https://bugs.debian.org/538685
dc requires whitespace between language elements.

We were requiring
1 2 + p
instead of the abbreviated
1 2+p
(for example).

function                                             old     new   delta
stack_machine                                         97     126     +29
dc_main                                              117      79     -38
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-38)             Total: -9 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agols: fix year 9999 bug :)
Denys Vlasenko [Mon, 16 Feb 2015 14:36:25 +0000 (15:36 +0100)]
ls: fix year 9999 bug :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe-small: fix thinko in previous commit
Denys Vlasenko [Fri, 13 Feb 2015 10:53:33 +0000 (11:53 +0100)]
modprobe-small: fix thinko in previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe-small: if concurrent module load did not succeed, wait
Denys Vlasenko [Thu, 12 Feb 2015 15:18:39 +0000 (16:18 +0100)]
modprobe-small: if concurrent module load did not succeed, wait

usecase:
two sd cards are being mounted in parallel at same time on dual core. example
modules which are getting loaded is  nls_cp437. While one module is being
loaded , it makes state in /proc/modules as 'coming' and then starts doing its
module init function (in our case - registering nls). meanwhile on other core,
if modprobe returns that is has already been loaded, then it will continue
and search for the nls list which is not yet finished from first module init.
This fails resulting in not mounting sd card.

function                                             old     new   delta
process_module                                       667     746     +79

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoi2cget, i2cset, i2cdetect, i2cdump: new applets
Bartosz Golaszewski [Tue, 10 Feb 2015 02:16:25 +0000 (03:16 +0100)]
i2cget, i2cset, i2cdetect, i2cdump: new applets

Add a minimal implementation of i2cget, i2cset, i2cdump and i2cdetect
tools. Supports most features of upstream i2c-tools.

function                                             old     new   delta
i2cdump_main                                           -    1444   +1444
i2cset_main                                            -    1239   +1239
i2cdetect_main                                         -     611    +611
list_i2c_busses_and_exit                               -     532    +532
packed_usage                                       29975   30438    +463
i2cget_main                                            -     380    +380
check_read_funcs                                       -     140    +140
i2c_funcs_tab                                          -     128    +128
confirm_action                                         -     100    +100
i2c_dev_open                                           -      57     +57
i2c_smbus_access                                       -      44     +44
confirm_or_abort                                       -      43     +43
check_funcs_test_end                                   -      39     +39
i2c_smbus_read_word_data                               -      38     +38
i2c_smbus_read_byte_data                               -      38     +38
i2c_smbus_read_byte                                    -      37     +37
i2c_set_slave_addr                                     -      32     +32
applet_names                                        2480    2512     +32
adap_descs                                             -      32     +32
i2c_set_pec                                            -      29     +29
get_funcs_matrix                                       -      21     +21
i2c_parse_data_addr                                    -      18     +18
i2c_parse_bus_addr                                     -      18     +18
i2c_bus_lookup                                         -      18     +18
i2c_smbus_write_byte                                   -      17     +17
applet_main                                         1440    1456     +16
will_skip                                              -      14     +14
no_support                                             -      11     +11
applet_nameofs                                       720     728      +8
applet_install_loc                                   180     182      +2
------------------------------------------------------------------------------
(add/remove: 26/0 grow/shrink: 5/0 up/down: 5601/0)          Total: 5601 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agounzip: prevent attacks via malicious filenames
Denys Vlasenko [Tue, 10 Feb 2015 00:30:43 +0000 (01:30 +0100)]
unzip: prevent attacks via malicious filenames

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: use getpwent() instead of getpwent_r()
Denys Vlasenko [Sat, 7 Feb 2015 20:21:02 +0000 (21:21 +0100)]
libpwdgrp: use getpwent() instead of getpwent_r()

function                                             old     new   delta
massage_data_for_non_r_func                            -      90     +90
bb_internal_getpwent                                   -      69     +69
getXXnam_r                                            94     162     +68
fill_bounds                                          131     128      -3
deluser_main                                         355     310     -45
complete_username                                    123      78     -45
getXXnam                                             163      90     -73
massage_data_for_r_func                              103       -    -103
bb_internal_getpwent_r                               121       -    -121
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/5 up/down: 227/-407)         Total: -163 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe-small: fix and simplify rmmod
Denys Vlasenko [Sat, 7 Feb 2015 19:44:46 +0000 (20:44 +0100)]
modprobe-small: fix and simplify rmmod

"rmmod OUT_OF_TREE_MODULE" was not working, because module is not in depmod file.

In general, rmmod doesn't need scanning, it simply unloads every argv[i].

function                                             old     new   delta
rmmod                                                  -      63     +63
modprobe_main                                        449     465     +16
process_module                                       705     667     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 79/-38)             Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb/loop: don't try to re-use existing loop device
Kevin Wallace [Wed, 4 Feb 2015 00:17:29 +0000 (16:17 -0800)]
libbb/loop: don't try to re-use existing loop device

loopinfo.lo_file_name is not enough to uniquely identify a file on a system with
multiple mount namespaces.  We could conceivably change this to dedup on
(lo_rdevice, lo_inode), but, as the comment above the deleted code notes, this
whole approach of reusing devices is racy anyway, so it seems better to stop
doing it entirely.

Signed-off-by: Kevin Wallace <k@igneous.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoexamples/mdev_fat.conf: document that newer mdev exposes path
Denys Vlasenko [Sat, 7 Feb 2015 17:14:39 +0000 (18:14 +0100)]
examples/mdev_fat.conf: document that newer mdev exposes path

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodd: add optional support for status=noxfer/none
Ari Sundholm [Sat, 7 Feb 2015 00:41:22 +0000 (01:41 +0100)]
dd: add optional support for status=noxfer/none

While at it, added 'B' number suffixes, upstream compat

function                                             old     new   delta
dd_main                                             1469    1543     +74
dd_suffixes                                           88     112     +24
packed_usage                                       30156   30176     +20
dd_output_status                                     372     388     +16
static.status_words                                    -      13     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 147/0)             Total: 147 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix a SEGV case in an invalid heredoc
Denys Vlasenko [Thu, 5 Feb 2015 20:00:17 +0000 (21:00 +0100)]
ash: fix a SEGV case in an invalid heredoc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodeluser: implement --remove-home
Denys Vlasenko [Thu, 5 Feb 2015 17:35:52 +0000 (18:35 +0100)]
deluser: implement --remove-home

function                                             old     new   delta
deluser_main                                         308     355     +47
packed_usage                                       30149   30156      +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 54/0)               Total: 54 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofstrim: fix help text
Denys Vlasenko [Wed, 4 Feb 2015 14:19:38 +0000 (15:19 +0100)]
fstrim: fix help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoroute: fix bogus read error when route table is empty
Denys Vlasenko [Tue, 3 Feb 2015 18:42:28 +0000 (19:42 +0100)]
route: fix bogus read error when route table is empty

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoroute: improve -A inet6
Denys Vlasenko [Tue, 3 Feb 2015 18:32:44 +0000 (19:32 +0100)]
route: improve -A inet6

Upstream route command shows non-up routes, it shows reject and nonexthop flags.
And we had "ref" and "use" values mixed up...

function                                             old     new   delta
flagvals                                              32      44     +12
flagchars                                              9      12      +3
INET_setroute                                        767     768      +1
INET6_setroute                                       495     496      +1
set_flags                                             43      39      -4
flags_ipvx                                            16       8      -8
route_main                                           632     623      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/3 up/down: 17/-21)             Total: -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogzip: trivial code shrink -5 bytes
Denys Vlasenko [Tue, 3 Feb 2015 14:25:17 +0000 (15:25 +0100)]
gzip: trivial code shrink -5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoifconfig: fix double free fatal error in INET_sprint
Denys Vlasenko [Tue, 3 Feb 2015 11:11:30 +0000 (12:11 +0100)]
ifconfig: fix double free fatal error in INET_sprint

Based on the patch by Zheng Junling <zhengjunling@huawei.com>
and Chen Gang <cg.chen@huawei.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport
Denys Vlasenko [Tue, 3 Feb 2015 11:07:40 +0000 (12:07 +0100)]
libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport

function                                             old     new   delta
INET_rresolve                                        274     214     -60
INET6_rresolve                                       168      85     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogzip: speed up and shrink put_16bit()
Denys Vlasenko [Mon, 2 Feb 2015 15:07:07 +0000 (16:07 +0100)]
gzip: speed up and shrink put_16bit()

function                                             old     new   delta
put_16bit                                            104      98      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogzip: do not store timestamp in gzip header
Rich Felker [Mon, 2 Feb 2015 15:01:16 +0000 (16:01 +0100)]
gzip: do not store timestamp in gzip header

Storing the original file's modification time in the output file is
harmful (precludes deterministic results) and unlike official gzip,
the busybox version provides no way to suppress this behavior; the -n
option is silently ignored. Rather than trying to make -n work, this
patch just removes the timestamp-storing functionality. It should be
considered deprecated anyway; it's not Y2038-safe and gunzip ignores
it by default.

Per RFC 1952, 0 is the correct value to store to indicate that there
is no timestamp.

Signed-off-by: Rich Felker <dalias@libc.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoplatform.h: enable mempcpy for FreeBSD
Denys Vlasenko [Mon, 2 Feb 2015 02:51:47 +0000 (03:51 +0100)]
platform.h: enable mempcpy for FreeBSD

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoubiattach: add option -O
Micke Prag [Sun, 2 Nov 2014 10:08:24 +0000 (11:08 +0100)]
ubiattach: add option -O

Some images do not have the default VID offset. The option -O must
be used to attach such images.

Signed-off-by: Micke Prag <micke.prag@telldus.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotelnetd: we only need CONFIG_UNIX98_PTYS from the Linux kernel
Martin Kaiser [Sun, 2 Nov 2014 22:23:16 +0000 (23:23 +0100)]
telnetd: we only need CONFIG_UNIX98_PTYS from the Linux kernel

(re-sending this as it got ignored completey and the format of the
previous mail was probably not correct - please let me know if there's
anything else I can do to get this trivial fix applied)

for telnetd to work, we only need CONFIG_UNIX98_PTYS to be enabled
in the Linux kernel - DEVPTS_FS has been obsolete for some time

Signed-off-by: Martin Kaiser <lists@kaiser.cx>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodpkg: update supported compression methods
Denys Vlasenko [Fri, 30 Jan 2015 14:15:38 +0000 (15:15 +0100)]
dpkg: update supported compression methods

Based on a patch by Ron Yorston <rmy@tigress.co.uk>

function                                             old     new   delta
get_header_tar_xz                                      -      60     +60
filter_accept_list_reassign                          128     188     +60
unpack_package                                       585     621     +36
init_archive_deb_control                              52      76     +24
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 180/0)             Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoplatform.h: mempcpy needs <string.h>
Denys Vlasenko [Thu, 29 Jan 2015 15:41:48 +0000 (16:41 +0100)]
platform.h: mempcpy needs <string.h>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agontpd: get rid of G.initial_poll_complete
Denys Vlasenko [Thu, 29 Jan 2015 15:31:36 +0000 (16:31 +0100)]
ntpd: get rid of G.initial_poll_complete

This speeds up syncing - now happens only just
two replies from a peer. Especially useful for "ntpd -q".
Shouldn't have ill effects: if we chose a bad peer,
we will discover it later and switch to another one.

The code is even smaller this way.

Suggested by Miroslav Lichvar <mlichvar@redhat.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodhcpd: fix an improper widening conversion
Denys Vlasenko [Tue, 27 Jan 2015 20:59:40 +0000 (21:59 +0100)]
dhcpd: fix an improper widening conversion

We wanted to detect when tv_sec = unsigned1 - unsigned2
underflows by looking at tv_sec's sign. But if tv_sec
is long and it is wider than unsigned, we get unsigned -> long
conversion which is in this case never negative.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: prevent zombies. closes 7832
Denys Vlasenko [Mon, 26 Jan 2015 14:45:48 +0000 (15:45 +0100)]
ftpd: prevent zombies. closes 7832

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoplatform.h: add compat mempcpy
Denys Vlasenko [Sun, 25 Jan 2015 21:08:46 +0000 (22:08 +0100)]
platform.h: add compat mempcpy

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodepmod: simple memory optimization
Denys Vlasenko [Sat, 24 Jan 2015 21:30:30 +0000 (22:30 +0100)]
depmod: simple memory optimization

function                                             old     new   delta
filename2modname                                      67      86     +19
parse_module                                         374     351     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotrim extra newlines in help texts
Denys Vlasenko [Sat, 24 Jan 2015 18:46:45 +0000 (19:46 +0100)]
trim extra newlines in help texts

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe: fix modprobe -r and parsing of /etc/modprobe.d
Natanael Copa [Fri, 16 Jan 2015 12:53:05 +0000 (13:53 +0100)]
modprobe: fix modprobe -r and parsing of /etc/modprobe.d

This fixes a regression introduced with commit 78854520 (modprobe:
revert checking for /, stop doing basename() on modprobe args,
2015-01-01) that broke modprobe options stored in /etc/modprobe.conf and
/etc/modprobe.d/*.conf.

This also fixes modprobe -r

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe: fix "modprobe devname:snd/timer" case (alias with a slash)
Denys Vlasenko [Thu, 15 Jan 2015 02:04:23 +0000 (03:04 +0100)]
modprobe: fix "modprobe devname:snd/timer" case (alias with a slash)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe: fix recent breakage: modules.dep reading code needs to strip dirname
Denys Vlasenko [Thu, 15 Jan 2015 01:48:36 +0000 (02:48 +0100)]
modprobe: fix recent breakage: modules.dep reading code needs to strip dirname

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe-small: code shrink
Denys Vlasenko [Sun, 11 Jan 2015 16:46:56 +0000 (17:46 +0100)]
modprobe-small: code shrink

function                                             old     new   delta
pathname_matches_modname                              80      42     -38

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe-small: fix recent breakage: modprobe -r was using full path
Denys Vlasenko [Sun, 11 Jan 2015 16:40:30 +0000 (17:40 +0100)]
modprobe-small: fix recent breakage: modprobe -r was using full path

"modprobe -r MODNAME", after it found the full module pathname,
should strip dirpath before trying to remove the module.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodiff: fix a bug in diffing against stdin. Closes 7784
Denys Vlasenko [Sun, 11 Jan 2015 15:41:54 +0000 (16:41 +0100)]
diff: fix a bug in diffing against stdin. Closes 7784

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agovi: fix reading of file after last line
Ron Yorston [Sun, 30 Nov 2014 20:39:53 +0000 (20:39 +0000)]
vi: fix reading of file after last line

If the :r command is used to read a file after the last line of the
buffer the last line of the buffer and the first line of the file
are joined.  An extra blank line appears at the end of the buffer.

   file 1
   file 1
   file 1file 2
   file 2
   file 2

~
~

The insertion point is normally at the start of the line following the
specified line.  When the specified line is the last one the next_line
function baulks at moving to the non-existent following line.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agovi: failure to open file is not an error when initialising buffer
Ron Yorston [Sun, 30 Nov 2014 20:39:25 +0000 (20:39 +0000)]
vi: failure to open file is not an error when initialising buffer

Commit 32afd3a introduced these regressions on the master branch:

Starting vi with no filename on the command line gives the status message
"'(null)' Bad address" instead of "- No file 1/1 100%".

Starting vi with a non-existent file on the command line gives the status
message "'new.txt' No such file or directory" instead of "- new.txt 1/1 100%"

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodepmod: fix recent breakage in modules.dep generation
Denys Vlasenko [Wed, 7 Jan 2015 13:39:01 +0000 (14:39 +0100)]
depmod: fix recent breakage in modules.dep generation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: line counting in error meesages is broken, remove it
Tito Ragusa [Tue, 6 Jan 2015 00:22:36 +0000 (01:22 +0100)]
libpwdgrp: line counting in error meesages is broken, remove it

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoswaponoff: add support for -e
René Rhéaume [Mon, 5 Jan 2015 19:35:00 +0000 (20:35 +0100)]
swaponoff: add support for -e

Signed-off-by: René Rhéaume <rene.rheaume@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agompstat: code shrink
Denys Vlasenko [Mon, 5 Jan 2015 17:39:23 +0000 (18:39 +0100)]
mpstat: code shrink

function                                             old     new   delta
get_uptime                                           134     129      -5
get_irqs_from_stat                                   110     103      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofree: handle "cached" value too
Guillermo Rodriguez [Mon, 5 Jan 2015 17:34:53 +0000 (18:34 +0100)]
free: handle "cached" value too

function                                             old     new   delta
free_main                                            356     481    +125

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: code shrink by factoring out common update_utmp_DEAD_PROCESS
Denys Vlasenko [Mon, 5 Jan 2015 14:37:58 +0000 (15:37 +0100)]
libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS

function                                             old     new   delta
update_utmp_DEAD_PROCESS                               -      17     +17
telnetd_main                                        1685    1674     -11
mark_terminated                                       56      45     -11
handle_sigchld                                        74      63     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodeleting unused ntpd_simple.c
Denys Vlasenko [Mon, 5 Jan 2015 14:12:37 +0000 (15:12 +0100)]
deleting unused ntpd_simple.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: fixes suggested by Tito, comment tweaks
Denys Vlasenko [Mon, 5 Jan 2015 14:09:04 +0000 (15:09 +0100)]
libpwdgrp: fixes suggested by Tito, comment tweaks

function                                             old     new   delta
bb_internal_getpwent_r                               100     121     +21
parse_common                                         202     203      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agontpd: relicense ntpd applet to ISC-style license
Adam Tkac [Sun, 4 Jan 2015 16:46:08 +0000 (17:46 +0100)]
ntpd: relicense ntpd applet to ISC-style license

OpenNTPd is licensed under ISC-style license so it's good idea to keep
ntpd applet under same license to avoid mess, instead of having
our changes to be under GPL.

Names of original code's authors are added.

Signed-off-by: Adam Tkac <vonsch@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: another code shrink
Denys Vlasenko [Sun, 4 Jan 2015 01:34:52 +0000 (02:34 +0100)]
libpwdgrp: another code shrink

function                                             old     new   delta
massage_data_for_r_func                                -     110    +110
bb_internal_getpwent_r                               173     100     -73
getXXnam_r                                           176      95     -81
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 110/-154)          Total: -44 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: code shrink
Denys Vlasenko [Sun, 4 Jan 2015 01:02:39 +0000 (02:02 +0100)]
libpwdgrp: code shrink

function                                             old     new   delta
parse_common                                         206     205      -1
getgrouplist_internal                                229     225      -4
bb_internal_getpwent_r                               182     173      -9
getXXnam                                             232     222     -10
getXXnam_r                                           216     176     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-64)             Total: -64 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: getgrXXX: empty string is not a member name, do not store it
Denys Vlasenko [Sat, 3 Jan 2015 20:16:18 +0000 (21:16 +0100)]
libpwdgrp: getgrXXX: empty string is not a member name, do not store it

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofix a SEGV in previous commit
Denys Vlasenko [Sat, 3 Jan 2015 20:11:27 +0000 (21:11 +0100)]
fix a SEGV in previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: fix counting of commas in group list
Denys Vlasenko [Sat, 3 Jan 2015 20:03:39 +0000 (21:03 +0100)]
libpwdgrp: fix counting of commas in group list

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: store getXXnam result in a single malloc block
Denys Vlasenko [Sat, 3 Jan 2015 19:47:47 +0000 (20:47 +0100)]
libpwdgrp: store getXXnam result in a single malloc block

This saves a bit of memory but more importantly, allows to create
xmalloc_getpwnam() API where result can be deleted simply using free().

function                                             old     new   delta
getXXnam                                             134     173     +39
parse_common                                         188     212     +24
convert_to_struct                                    277     290     +13
get_S                                                 90      88      -2
tokenize                                             129     126      -3
bb_internal_getpwent_r                               175     172      -3
getXXnam_r                                           208     198     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/4 up/down: 76/-18)             Total: 58 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: make db->def[] one byte shorter
Denys Vlasenko [Sat, 3 Jan 2015 18:12:49 +0000 (19:12 +0100)]
libpwdgrp: make db->def[] one byte shorter

In the future I will need another uint8_t, want to fit it
w/o using another word on 32 bits.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: use a better estimate of max struct size
Denys Vlasenko [Sat, 3 Jan 2015 16:53:49 +0000 (17:53 +0100)]
libpwdgrp: use a better estimate of max struct size

Previous code's trick with bitwise OR was giving this on 32-bit x86:

sizeof(struct passwd):28
sizeof(struct group):16
sizeof(struct spwd):36
sizeof(struct_result):60

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: reinstate Tito's optional atexit freeing
Denys Vlasenko [Sat, 3 Jan 2015 15:09:05 +0000 (16:09 +0100)]
libpwdgrp: reinstate Tito's optional atexit freeing

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: fix a memory leak in getXXnam (we did not save address of string buf)
Denys Vlasenko [Sat, 3 Jan 2015 14:54:04 +0000 (15:54 +0100)]
libpwdgrp: fix a memory leak in getXXnam (we did not save address of string buf)

function                                             old     new   delta
convert_to_struct                                    261     269      +8
const_sp_db                                           20      24      +4
const_pw_db                                           20      24      +4
const_gr_db                                           20      24      +4
tokenize                                             144     147      +3
parse_common                                         185     188      +3
get_S                                                 82      85      +3
bb_internal_getpwent_r                               188     185      -3
gr_off                                                 4       -      -4
getXXnam                                             171     165      -6
pw_off                                                 7       -      -7
getgrouplist_internal                                237     229      -8
getXXnam_r                                           215     207      -8
sp_off                                                 9       -      -9
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 7/4 up/down: 29/-45)            Total: -16 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: tweak comments, replace one xmalloc with xzalloc
Denys Vlasenko [Sat, 3 Jan 2015 14:15:47 +0000 (15:15 +0100)]
libpwdgrp: tweak comments, replace one xmalloc with xzalloc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: use FAST_FUNC to make "matching ABI" optimization more likely to succeed
Denys Vlasenko [Fri, 2 Jan 2015 21:31:07 +0000 (22:31 +0100)]
libpwdgrp: use FAST_FUNC to make "matching ABI" optimization more likely to succeed

See bb_internal_get*nam_r size reduction:

function                                             old     new   delta
bb_internal_getpwent_r                               167     176      +9
getXXnam_r                                           204     206      +2
sulogin_main                                         326     325      -1
su_main                                              471     470      -1
read_line_input                                     3832    3831      -1
print_stat                                           865     864      -1
prepare_socket_fd                                    283     282      -1
load_crontab                                         777     776      -1
fork_job                                             456     455      -1
do_shm                                               884     883      -1
do_sem                                               637     636      -1
do_msg                                               783     782      -1
complete_username                                    124     123      -1
bb_internal_getgrouplist                              71      70      -1
xgetpwuid                                             27      25      -2
xgetpwnam                                             27      25      -2
xgetgrnam                                             27      25      -2
xgetgrgid                                             27      25      -2
uid2uname                                             18      16      -2
login_main                                           980     978      -2
gid2group                                             18      16      -2
get_shell_name                                        54      52      -2
change_identity                                       50      48      -2
bb_internal_initgroups                                50      48      -2
argstr                                              1261    1259      -2
print_perms                                          177     174      -3
inetd_main                                          2077    2074      -3
run_applet_no_and_exit                               446     442      -4
fileaction_setowngrp                                  89      85      -4
deluser_main                                         312     308      -4
bb_internal_getpwuid                                  19      15      -4
bb_internal_getpwnam                                  11       7      -4
bb_internal_getgrnam                                  14      10      -4
bb_internal_getgrgid                                  19      15      -4
adduser_main                                         865     861      -4
passwd_main                                          989     984      -5
get_passwd                                            97      92      -5
data_extract_all                                     887     882      -5
check_user_passwd                                    490     485      -5
get_groups                                            81      75      -6
ftpd_main                                           2178    2171      -7
bb_internal_getspnam_r                                42      18     -24
bb_internal_getpwnam_r                                39      15     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/41 up/down: 11/-153)         Total: -142 bytes
   text    data     bss     dec     hex filename
 923167     928   17676  941771   e5ecb busybox_old
 923023     928   17676  941627   e5e3b busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: rewritten to use malloced implementation
Tito Ragusa [Fri, 2 Jan 2015 20:37:59 +0000 (21:37 +0100)]
libpwdgrp: rewritten to use malloced implementation

This removed buffer size limitations.

function                                             old     new   delta
convert_to_struct                                      -     269    +269
getXXnam_r                                             -     204    +204
parse_common                                           -     185    +185
getXXnam                                               -     164    +164
tokenize                                               -     126    +126
bb_internal_getpwent_r                               102     167     +65
get_S                                                 30      88     +58
getgrouplist_internal                                195     240     +45
const_sp_db                                            -      20     +20
const_pw_db                                            -      20     +20
const_gr_db                                            -      20     +20
bb_internal_endpwent                                  27      36      +9
bb_internal_endgrent                                  27      36      +9
decode_one_format                                    726     734      +8
bb_internal_setpwent                                  17      24      +7
volume_id_probe_iso9660                              319     322      +3
scriptreplay_main                                    204     207      +3
mkfs_minix_main                                     2684    2687      +3
id_main                                              478     480      +2
hash_find                                            233     235      +2
pstree_main                                          321     322      +1
gr_off                                                 3       4      +1
expand_one_var                                      1579    1578      -1
pwf                                                    4       -      -4
grf                                                    4       -      -4
pack_gzip                                           1787    1780      -7
addattr32                                             67      56     -11
buffer_fill_and_print                                191     178     -13
dpkg_main                                           2944    2927     -17
bb_internal_setgrent                                  17       -     -17
bb_internal_getpwuid                                  38      19     -19
bb_internal_getgrgid                                  44      19     -25
bb_internal_getpwnam                                  38      11     -27
bb_internal_getgrnam                                  44      14     -30
bb_internal_fgetpwent_r                               51       -     -51
bb_internal_fgetgrent_r                               51       -     -51
bb_internal_getspnam_r                               121      42     -79
bb_internal_getpwnam_r                               121      39     -82
bb_internal_getgrent_r                               102       -    -102
bb__parsepwent                                       110       -    -110
bb_internal_getpwuid_r                               113       -    -113
bb_internal_getgrgid_r                               113       -    -113
bb__parsespent                                       120       -    -120
bb_internal_getgrnam_r                               121       -    -121
bb__pgsreader                                        213       -    -213
bb__parsegrent                                       226       -    -226
------------------------------------------------------------------------------
(add/remove: 8/13 grow/shrink: 14/11 up/down: 1224/-1556)    Total: -332 bytes
   text    data     bss     dec     hex filename
 923471     928   17684  942083   e6003 busybox_old
 923167     928   17676  941771   e5ecb busybox_unstripped

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe: revert checking for /, stop doing basename() on modprobe args
Denys Vlasenko [Thu, 1 Jan 2015 18:02:40 +0000 (19:02 +0100)]
modprobe: revert checking for /, stop doing basename() on modprobe args

function                                             old     new   delta
process_module                                       726     719      -7
filename2modname                                      81      67     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-21)             Total: -21 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoMakefile: fix cscope target
Bartosz Golaszewski [Wed, 17 Dec 2014 16:58:23 +0000 (17:58 +0100)]
Makefile: fix cscope target

This target doesn't work with current directory layout. Just make cscope
index all .c and .h files.

While we're at it: add cscope output files to .gitignore.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix a SEGV in ${#1}
Denys Vlasenko [Sun, 28 Dec 2014 23:04:18 +0000 (00:04 +0100)]
ash: fix a SEGV in ${#1}

function                                             old     new   delta
varvalue                                             760     805     +45
evalvar                                              648     603     -45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpd: account for script delay in lease
John Schroeder [Thu, 25 Dec 2014 20:12:51 +0000 (21:12 +0100)]
udhcpd: account for script delay in lease

Prevent nasty surprises if script runs longer than lease time / 2.

Signed-off-by: John Schroeder <jschroed@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoStart 1.24.0 development cycle
Denys Vlasenko [Wed, 24 Dec 2014 01:06:02 +0000 (02:06 +0100)]
Start 1.24.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoBump version to 1.23.0 1_23_0
Denys Vlasenko [Wed, 24 Dec 2014 00:23:34 +0000 (01:23 +0100)]
Bump version to 1.23.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: add sanity check in bb_arg_max()
Denys Vlasenko [Wed, 24 Dec 2014 00:46:29 +0000 (01:46 +0100)]
libbb: add sanity check in bb_arg_max()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorandomconfig fixes
Denys Vlasenko [Mon, 22 Dec 2014 18:37:05 +0000 (19:37 +0100)]
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoMake it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGS
Peter Kümmel [Mon, 22 Dec 2014 00:55:54 +0000 (01:55 +0100)]
Make it possible to override LOGIN_FAIL_DELAY in CONFIG_EXTRA_CFLAGS

Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpc: account for script run time
Denys Vlasenko [Sun, 21 Dec 2014 15:10:22 +0000 (16:10 +0100)]
udhcpc: account for script run time

Based on the following user report:

I ran into an issue where I was seeing a long delay in the scripts called
in udhcp_run_script. I was using an old version of OpenWrt (kamikaze)
and a satellite modem. An NTP script was being called and the modem
would sometimes take a long time to respond to the DNS lookup when
it was offline.

This delay started affecting my lease time. The lease that I would
get from my satellite modem before it was online would be short:
only 60 seconds. The delay with NTP and the modem would typically
be about 18 seconds. This would cause the first DHCP renew request
from dhcpc to be a little late. Under certain circumstances,
I could even see the first DHCP renew to occur after the lease
had expired!

function                                             old     new   delta
udhcpc_main                                         2816    2837     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonanddump: don't show --bb in usage when disabled
Baruch Siach [Wed, 17 Dec 2014 22:27:26 +0000 (00:27 +0200)]
nanddump: don't show --bb in usage when disabled

The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage
text when LONG_OPTS is disabled.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonandwrite: fix build when long options are disabled
Baruch Siach [Wed, 17 Dec 2014 16:02:37 +0000 (17:02 +0100)]
nandwrite: fix build when long options are disabled

The Required_argument macro is only defined when long options are enabled.
Fixes the following build error:

miscutils/nandwrite.c: In function 'nandwrite_main':
miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument'

Reported-by: Christian Kästner <kaestner at cs.cmu.edu>
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolineedit: don't block when looking for escape sequence in vi-mode
Ron Yorston [Fri, 12 Dec 2014 08:29:41 +0000 (08:29 +0000)]
lineedit: don't block when looking for escape sequence in vi-mode

In vi-mode lineedit tries to detect some escape sequences.
After the ESC it reads the next character to check for certain
values.  This read should have a timeout or a user-entered ESC to
switch to command mode doesn't properly handle the next character.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotar: fix "tar -cJ" ignoring -J option. closes 7706
Denys Vlasenko [Thu, 11 Dec 2014 14:33:07 +0000 (15:33 +0100)]
tar: fix "tar -cJ" ignoring -J option. closes 7706

function                                             old     new   delta
tar_main                                             895     938     +43
vfork_compressor                                     206     191     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 43/-15)             Total: 28 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolineedit: don't fall back to simple line input if tty is in raw mode
Denys Vlasenko [Wed, 10 Dec 2014 16:22:13 +0000 (17:22 +0100)]
lineedit: don't fall back to simple line input if tty is in raw mode

Testcase: shell command input after python ^Z should still work

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoConfig: select PLATFORM_LINUX if using sendfile()
Bartosz Golaszewski [Wed, 10 Dec 2014 12:34:42 +0000 (13:34 +0100)]
Config: select PLATFORM_LINUX if using sendfile()

Man entry for sendfile:

  Not specified in POSIX.1-2001, or other standards.

  Other UNIX systems implement sendfile() with different  semantics  and
  prototypes. It should not be used in portable programs.

Select PLATFORM_LINUX if enabling FEATURE_USE_SENDFILE.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoflashcp: change BUFSIZE to 4k
Jacob Kjaergaard [Wed, 10 Dec 2014 12:44:27 +0000 (13:44 +0100)]
flashcp: change BUFSIZE to 4k

some flash partitions can be smaller than the existing BUFSIZE thus write
BUFSIZE will fail with "no space left on device"

Signed-off-by: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomake xmalloc_open_zipped_read_close result NUL terminated
Denys Vlasenko [Sat, 6 Dec 2014 23:49:55 +0000 (00:49 +0100)]
make xmalloc_open_zipped_read_close result NUL terminated

Compat with xmalloc_open_read_close

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibarchive: add capability to unpack to mem.buffer
Denys Vlasenko [Sat, 6 Dec 2014 23:44:00 +0000 (00:44 +0100)]
libarchive: add capability to unpack to mem.buffer

The performance and number of processes for a "depmod -a" with gzipped
modules was abysmal. This patch adds a code path without fork,
benefiting all users of xmalloc_open_zipped_read_close.

"modinfo radeon.ko.gz", a single-file reader, got 30% faster.
"depmod -a", which used to fork over 800 times, got 20% faster.

Heavily based on a patch by Lauri Kasanen <curaga@operamail.com>

function                                             old     new   delta
setup_transformer_on_fd                                -     159    +159
transformer_write                                      -     122    +122
fork_transformer                                       -     112    +112
xmalloc_open_zipped_read_close                        63     118     +55
read_bunzip                                         1866    1896     +30
xtransformer_write                                     -      19     +19
unzip_main                                          2449    2462     +13
bbunpack                                             755     766     +11
unpack_lzma_stream                                  2717    2723      +6
unpack_xz_stream                                    2393    2397      +4
unpack_Z_stream                                     1173    1175      +2
inflate_unzip                                        111     105      -6
check_signature16                                     70      63      -7
unpack_bz2_stream                                    359     349     -10
unpack_unxz                                           12       -     -12
unpack_unlzma                                         12       -     -12
unpack_uncompress                                     12       -     -12
unpack_gunzip                                         12       -     -12
unpack_bunzip2                                        12       -     -12
open_transformer                                     106      92     -14
inflate_unzip_internal                              1945    1916     -29
unpack_gz_stream                                     693     655     -38
open_zipped                                           89      47     -42
setup_unzip_on_fd                                    142      53     -89
------------------------------------------------------------------------------
(add/remove: 4/5 grow/shrink: 7/8 up/down: 533/-295)          Total: 238 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoRename transformer_aux_data_t -> transformer_state_t
Denys Vlasenko [Sat, 6 Dec 2014 23:42:49 +0000 (00:42 +0100)]
Rename transformer_aux_data_t -> transformer_state_t

No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoman: do not mangle $MANPATH in memory
Denys Vlasenko [Sun, 30 Nov 2014 18:39:58 +0000 (19:39 +0100)]
man: do not mangle $MANPATH in memory

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: use sendfile() to copy data between file descriptors
Bartosz Golaszewski [Thu, 27 Nov 2014 12:20:24 +0000 (13:20 +0100)]
libbb: use sendfile() to copy data between file descriptors

Busybox already uses sendfile in httpd. This patch proposes to use it
globally to copy data between file descriptors.

It speeds up the copying on slow systems a lot - below are the times needed
to copy a 450Mb file with and without this option enabled on a BeagleBone
Black:

sendfile:
user    0m0.000s
sys     0m8.170s

read/write 4k:
user    0m0.470s
sys     0m16.300s

function                                             old     new   delta
bb_full_fd_action                                    394     474     +80

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoman: accept a list of dirs in $MANPATH
Denys Vlasenko [Wed, 26 Nov 2014 23:40:08 +0000 (00:40 +0100)]
man: accept a list of dirs in $MANPATH

function                                             old     new   delta
add_MANPATH                                            -     143    +143
man_main                                             852     731    -121
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 143/-121)           Total: 22 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: use ARG_MAX for bb_arg_max() only if it's 60k+
Denys Vlasenko [Wed, 26 Nov 2014 14:17:59 +0000 (15:17 +0100)]
libbb: use ARG_MAX for bb_arg_max() only if it's 60k+

Sometimes ARG_MAX is small (like 32k) yet sysconf(_SC_ARG_MAX)
is big, and people prefer using the bigger value.

OTOH, with sufficiently large ARG_MAX, further wins from
sysconf(_SC_ARG_MAX) being bigger are exponentially smaller:
you can see 4 times fewer fork+execs when you run find, but
when each execed process already takes a thousand parameters
it's likely execution time is dominated by what that process
does with each parameter.

Thus, with this change ARG_MAX is used if it's sufficiently big,
otherwise sysconf(_SC_ARG_MAX) is used.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agobbunit: fix WANT_TIMING compilation
Denys Vlasenko [Wed, 26 Nov 2014 13:04:51 +0000 (14:04 +0100)]
bbunit: fix WANT_TIMING compilation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogitignore: add testsuite/echo-ne
Bartosz Golaszewski [Wed, 26 Nov 2014 12:28:54 +0000 (13:28 +0100)]
gitignore: add testsuite/echo-ne

Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpd: if a lease from lease file coincides with a static one, ignore it
Denys Vlasenko [Tue, 25 Nov 2014 17:49:14 +0000 (18:49 +0100)]
udhcpd: if a lease from lease file coincides with a static one, ignore it

function                                             old     new   delta
read_leases                                          269     328     +59

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoinit: do not run shutdown/reexec actions from signal handler
Denys Vlasenko [Fri, 21 Nov 2014 19:10:57 +0000 (20:10 +0100)]
init: do not run shutdown/reexec actions from signal handler

this is racy wrt various libc functions such as syslog()

function                                             old     new   delta
check_delayed_sigs                                   182     352    +170
init_main                                            772     728     -44
restart_handler                                       74       -     -74
halt_reboot_pwoff                                     79       -     -79
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/1 up/down: 170/-197)          Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe,rmmod: reject module names with slashes
Denys Vlasenko [Thu, 20 Nov 2014 17:24:33 +0000 (18:24 +0100)]
modprobe,rmmod: reject module names with slashes

function                                             old     new   delta
add_probe                                             86     113     +27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotypo fix in comment
Denys Vlasenko [Thu, 20 Nov 2014 00:43:30 +0000 (01:43 +0100)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: do not segfault on $((2**63 / -1))
Denys Vlasenko [Tue, 18 Nov 2014 13:32:58 +0000 (14:32 +0100)]
ash,hush: do not segfault on $((2**63 / -1))

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash: fix handling of negative start value in ${v:start:len}
Denys Vlasenko [Mon, 17 Nov 2014 19:27:18 +0000 (20:27 +0100)]
ash: fix handling of negative start value in ${v:start:len}

function                                             old     new   delta
subevalvar                                          1140    1168     +28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoiproute: support onelink route option and print route flags
Michael Tokarev [Mon, 28 Jul 2014 06:05:41 +0000 (10:05 +0400)]
iproute: support onelink route option and print route flags

function                                             old     new   delta
print_route                                         1797    1865     +68
do_iproute                                          2097    2112     +15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 83/0)               Total: 83 bytes

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoexit with 127 if appled name wasn't found - it's more POSIXy
Denys Vlasenko [Mon, 17 Nov 2014 16:03:47 +0000 (17:03 +0100)]
exit with 127 if appled name wasn't found - it's more POSIXy

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agozcip: Add environment variable for overriding log functionality
Michel Stam [Tue, 4 Nov 2014 11:19:04 +0000 (12:19 +0100)]
zcip: Add environment variable for overriding log functionality

function                                             old     new   delta
bb_logenv_override                                     -      70     +70
packed_usage                                       29969   30033     +64
zcip_main                                           1426    1431      +5
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 139/0)             Total: 139 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agozcip: allow our own class B range to be used for ZeroConf
Michel Stam [Thu, 30 Oct 2014 12:43:09 +0000 (13:43 +0100)]
zcip: allow our own class B range to be used for ZeroConf

169.254 may already be used by a local network. This patch allows
specifying your own IP range.

Our particular use case is a mesh network, in which the nodes partaking
were using an IP range specifically assigned for the meshing purpose.
As the LAN side of the mesh node could use 169.254, this default range
was not an option.

function                                             old     new   delta
zcip_main                                           1342    1426     +84
pick_nip                                               -      40     +40
packed_usage                                       29974   29969      -5
pick                                                  34       -     -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 124/-39)            Total: 85 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpd: add option for tweaking arpping
Michel Stam [Thu, 30 Oct 2014 10:59:04 +0000 (11:59 +0100)]
udhcpd: add option for tweaking arpping

Some clients have a very short timeout for sending the DHCP
DISCOVER, shorter than the arpping timeout of 2000 milliseconds
that udhcpd uses by default.

This patch allows tweaking the timeout, or disabling of arpping
altogether, at the risk of handing out addresses which are
already in use.

function                                             old     new   delta
udhcpd_main                                         1460    1501     +41
udhcpc_main                                         2814    2851     +37
packed_usage                                       29957   29974     +17
arpping                                              477     493     +16
find_free_or_expired_nip                             161     174     +13
send_offer                                           285     292      +7
nobody_responds_to_arp                                85      89      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 135/0)             Total: 135 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: calculate offset to jitter ratio before updating jitter
Miroslav Lichvar [Sun, 5 Oct 2014 01:10:15 +0000 (03:10 +0200)]
ntpd: calculate offset to jitter ratio before updating jitter

The offset to jitter ratio is now calculated before updating
jitter to make the test more sensitive.

function                                             old     new   delta
ntp_init                                             460     474     +14
update_local_clock                                   752     764     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 26/0)               Total: 26 bytes

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>