platform/upstream/busybox.git
12 years agolibbb: remove is_directory's argument which is always NULL
Denys Vlasenko [Sun, 18 Dec 2011 02:27:46 +0000 (03:27 +0100)]
libbb: remove is_directory's argument which is always NULL

function                                             old     new   delta
send_cgi_and_exit                                    892     890      -2
ln_main                                              447     445      -2
handle_incoming_and_exit                            2784    2780      -4
is_directory                                          66      59      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19)             Total: -15 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agohttpd: remove redundant NULL assignment and save one strrchr. -8 bytes
Denys Vlasenko [Sun, 18 Dec 2011 02:22:36 +0000 (03:22 +0100)]
httpd: remove redundant NULL assignment and save one strrchr. -8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcp: finish support of classless static routes (now the correct patch!)
Michael McTernan [Fri, 16 Dec 2011 16:10:09 +0000 (17:10 +0100)]
udhcp: finish support of classless static routes (now the correct patch!)

Signed-off-by: Michael McTernan <Michael.McTernan.2001@cs.bris.ac.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcp: finish support of classless static routes
Michael McTernan [Fri, 16 Dec 2011 16:05:52 +0000 (17:05 +0100)]
udhcp: finish support of classless static routes

function                                             old     new   delta
udhcp_str2optset                                     415     532    +117

Signed-off-by: Michael McTernan <Michael.McTernan.2001@cs.bris.ac.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agovconfig: remove /proc/net/vlan/config check
Paulius Zaleckas [Fri, 16 Dec 2011 00:42:55 +0000 (01:42 +0100)]
vconfig: remove /proc/net/vlan/config check

In original implementation /proc/net/vlan/config check only prints warning
and does not exit. Busybox version exits if this file is not found and this
prevents kernel module autoloading to work.
I think it is safe to remove this check since ioctl() call will fail
(with proper
error code) anyway if 802.1q module is not loaded (or autoloading is off).

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agohttpd: fix /../ sanitization (had one extra semicolon). rewrote it
Denys Vlasenko [Fri, 16 Dec 2011 00:37:02 +0000 (01:37 +0100)]
httpd: fix /../ sanitization (had one extra semicolon). rewrote it

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoash: document bash's exit code too. No code changes
Denys Vlasenko [Thu, 15 Dec 2011 23:44:36 +0000 (00:44 +0100)]
ash: document bash's exit code too. No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoash: add comment about bash's ENOEXEC handling. No code changes
Denys Vlasenko [Thu, 15 Dec 2011 23:25:17 +0000 (00:25 +0100)]
ash: add comment about bash's ENOEXEC handling. No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years ago*: style fixes. no code changes
Denys Vlasenko [Thu, 15 Dec 2011 11:39:25 +0000 (12:39 +0100)]
*: style fixes. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoifupdown: remove interface from state_list if iface_up fails
Lauri Hintsala [Wed, 14 Dec 2011 14:49:58 +0000 (16:49 +0200)]
ifupdown: remove interface from state_list if iface_up fails

Fix the issue where interface is set to the configured state even if
configuration has failed. Add error check to state setting logic.

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoconfigs/android_defconfig: update
Daniel Fandrich [Thu, 15 Dec 2011 09:14:51 +0000 (10:14 +0100)]
configs/android_defconfig: update

Signed-off-by: Daniel Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotouch: add new option FEATURE_TOUCH_SUSV3
walter harms [Wed, 14 Dec 2011 07:48:59 +0000 (08:48 +0100)]
touch: add new option FEATURE_TOUCH_SUSV3

This options -d -t -r where hidden under DESKTOP.
This option allows the user to enable these options for (only) touch.

The patch only changes DESKTOP to FEATURE_TOUCH_SUSV3.

Signed-off-by: walter harms <wharms@bfs.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotouch: document -t DT option in help text
Denys Vlasenko [Tue, 13 Dec 2011 15:56:47 +0000 (16:56 +0100)]
touch: document -t DT option in help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: sanitize hostnames in incoming packets. Closes 3979.
Denys Vlasenko [Thu, 8 Dec 2011 15:41:05 +0000 (16:41 +0100)]
udhcpc: sanitize hostnames in incoming packets. Closes 3979.

The following options are replaced with string "bad" if they
contain malformed hostname:
HOST_NAME, DOMAIN_NAME, NIS_DOMAIN, TFTP_SERVER_NAME

function                                             old     new   delta
xmalloc_optname_optval                               850     888     +38
attach_option                                        440     443      +3
len_of_option_as_string                               13      14      +1
dhcp_option_lengths                                   13      14      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 43/0)               Total: 43 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoiproute: fix help text
Denys Vlasenko [Tue, 6 Dec 2011 17:59:55 +0000 (18:59 +0100)]
iproute: fix help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoblkid: make help text show [BLOCKDEV]...
Denys Vlasenko [Tue, 6 Dec 2011 14:09:27 +0000 (15:09 +0100)]
blkid: make help text show [BLOCKDEV]...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agovolume_id/get_devname: trivial code shrink
Denys Vlasenko [Tue, 6 Dec 2011 14:06:59 +0000 (15:06 +0100)]
volume_id/get_devname: trivial code shrink

function                                             old     new   delta
uuidcache_init                                        36      41      +5
get_devname_from_uuid                                 55      51      -4
get_devname_from_label                                61      57      -4
display_uuid_cache                                   109     105      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 5/-12)              Total: -7 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agosuppress a "integer overflow in expression" waring on big endian. Closes 4405
Denys Vlasenko [Mon, 5 Dec 2011 03:54:14 +0000 (04:54 +0100)]
suppress a "integer overflow in expression" waring on big endian. Closes 4405

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix link failure on some platforms when PAM is enabled
Tristan Schmelcher [Mon, 5 Dec 2011 03:38:58 +0000 (04:38 +0100)]
Fix link failure on some platforms when PAM is enabled

Signed-off-by: Tristan Schmelcher <tristan_schmelcher@alumni.uwaterloo.ca>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoinit: code shrink -4 bytes
Denys Vlasenko [Mon, 5 Dec 2011 02:54:28 +0000 (03:54 +0100)]
init: code shrink -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoinit: utmp update of DEAD_PROCESS was misplaced, and could be skipped. Fixing.
Denys Vlasenko [Mon, 5 Dec 2011 02:31:05 +0000 (03:31 +0100)]
init: utmp update of DEAD_PROCESS was misplaced, and could be skipped. Fixing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agohttpd: small fixes to previous change
Pascal Bellard [Tue, 29 Nov 2011 19:54:30 +0000 (20:54 +0100)]
httpd: small fixes to previous change

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agohttpd: make it possible to use system passwords for auth
Pascal Bellard [Tue, 29 Nov 2011 12:51:11 +0000 (13:51 +0100)]
httpd: make it possible to use system passwords for auth

function                                             old     new   delta
check_user_passwd                                    320     467    +147
httpd_main                                           760     757      -3

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoold_e2fsprogs/blkid: close the fd after we are done with it
Denys Vlasenko [Mon, 28 Nov 2011 17:57:04 +0000 (18:57 +0100)]
old_e2fsprogs/blkid: close the fd after we are done with it

Some people have HUGE /dev/*...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agovi: fix [end] key handling
Denys Vlasenko [Mon, 28 Nov 2011 03:55:48 +0000 (04:55 +0100)]
vi: fix [end] key handling

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agorx: fix file corruption on block checksum failure
Daniel Fandrich [Wed, 23 Nov 2011 11:07:31 +0000 (12:07 +0100)]
rx: fix file corruption on block checksum failure

Rather than dropping the bad block, rx was appending it
to the file.

Signed-off-by: Daniel Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonommu: fix cases where we mangle argv[0][0]
Denys Vlasenko [Tue, 22 Nov 2011 16:19:26 +0000 (17:19 +0100)]
nommu: fix cases where we mangle argv[0][0]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAdded a few more features to android_defconfig
Daniel Fandrich [Sun, 6 Nov 2011 23:06:16 +0000 (15:06 -0800)]
Added a few more features to android_defconfig

Signed-off-by: Daniel Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMerge branch 'master' of git+ssh://busybox.net/var/lib/git/busybox
Denys Vlasenko [Mon, 21 Nov 2011 13:25:15 +0000 (14:25 +0100)]
Merge branch 'master' of git+ssh://busybox.net/var/lib/git/busybox

12 years agomakemime: document our current behavior. Tweak help text
Denys Vlasenko [Sat, 19 Nov 2011 13:43:02 +0000 (14:43 +0100)]
makemime: document our current behavior. Tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomakemime: content-type should default to application/octet-stream
Denys Vlasenko [Sat, 19 Nov 2011 12:55:46 +0000 (13:55 +0100)]
makemime: content-type should default to application/octet-stream

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agosendmail: fix a mistake in previous commit
Denys Vlasenko [Sat, 19 Nov 2011 12:54:50 +0000 (13:54 +0100)]
sendmail: fix a mistake in previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agosendmail: stop doing -t unconditionally; makemime: generate 76 char base64 lines
Denys Vlasenko [Fri, 18 Nov 2011 21:25:35 +0000 (22:25 +0100)]
sendmail: stop doing -t unconditionally; makemime: generate 76 char base64 lines

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agohexdump: fix hexdump -n1 -ve '8/2 ""' SEGV. Closes 4478
Denys Vlasenko [Fri, 18 Nov 2011 01:47:35 +0000 (02:47 +0100)]
hexdump: fix hexdump -n1 -ve '8/2 ""' SEGV. Closes 4478

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: shrink code by setting xid more economically
Denys Vlasenko [Fri, 18 Nov 2011 01:09:13 +0000 (02:09 +0100)]
udhcpc: shrink code by setting xid more economically

function                                             old     new   delta
send_decline                                          90      82      -8
udhcpc_main                                         2649    2640      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolibbb.h: add check for bad off_t size detection
Denys Vlasenko [Thu, 17 Nov 2011 20:51:32 +0000 (21:51 +0100)]
libbb.h: add check for bad off_t size detection

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolibbb.h: tighten up macro code
Denys Vlasenko [Wed, 16 Nov 2011 20:30:19 +0000 (21:30 +0100)]
libbb.h: tighten up macro code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc6: rudimentary code to export data to script; fix IAADDR parsing
Denys Vlasenko [Wed, 16 Nov 2011 19:17:12 +0000 (20:17 +0100)]
udhcpc6: rudimentary code to export data to script; fix IAADDR parsing

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoapplets_sh/nologin: an applet implemented as shell script
Denys Vlasenko [Thu, 10 Nov 2011 17:00:28 +0000 (18:00 +0100)]
applets_sh/nologin: an applet implemented as shell script

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomount: resolve hosts to IPs in nfs mounts
Denys Vlasenko [Thu, 10 Nov 2011 16:01:39 +0000 (17:01 +0100)]
mount: resolve hosts to IPs in nfs mounts

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomount: make FEATURE_MOUNT_NFS not needed for Linux 2.6.23+
Denys Vlasenko [Thu, 10 Nov 2011 15:53:35 +0000 (16:53 +0100)]
mount: make FEATURE_MOUNT_NFS not needed for Linux 2.6.23+

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomount: support -o noacl
Dave Love [Thu, 10 Nov 2011 14:19:25 +0000 (15:19 +0100)]
mount: support -o noacl

Signed-off-by: Dave Love <fx@gnu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoConfig: clarify {SHOW,VERBOSE,COMPRESS}_USAGE
Bernhard Reutner-Fischer [Wed, 9 Nov 2011 19:23:38 +0000 (20:23 +0100)]
Config: clarify {SHOW,VERBOSE,COMPRESS}_USAGE

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
12 years agobb_daemonize_or_rexec(): add flag to double-fork; use it in start-stop-daemon
Peter Korsgaard [Wed, 9 Nov 2011 18:44:37 +0000 (19:44 +0100)]
bb_daemonize_or_rexec(): add flag to double-fork; use it in start-stop-daemon

Add a DAEMON_DOUBLE_FORK flag to make bb_daemonize double-fork so it isn't a
session leader, and hence doesn't get a controlling tty on Linux if a tty is
ever opened, similar to how libdaemon's daemon_fork or the big
start-stop-daemon does it - And use it in start-stop-daemon.

For details, see http://www.win.tue.nl/~aeb/linux/lk/lk-10.html#ss10.3

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc[6]: tweak help text, remove -B from udhcpc6 and "--version" from both
Denys Vlasenko [Tue, 8 Nov 2011 10:39:41 +0000 (11:39 +0100)]
udhcpc[6]: tweak help text, remove -B from udhcpc6 and "--version" from both

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc6: set hop limit to 1 in emitted raw packets
Denys Vlasenko [Mon, 7 Nov 2011 17:22:06 +0000 (18:22 +0100)]
udhcpc6: set hop limit to 1 in emitted raw packets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc6: fix endianness
Denys Vlasenko [Mon, 7 Nov 2011 15:21:24 +0000 (16:21 +0100)]
udhcpc6: fix endianness

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc6: new applet. Not yet functional.
Denys Vlasenko [Mon, 7 Nov 2011 14:55:39 +0000 (15:55 +0100)]
udhcpc6: new applet. Not yet functional.

It builds. It sends Solicit packets. Not sure these packets are well-formed.
I have no server to test it against.

function                                             old     new   delta
udhcpc6_main                                           -    2426   +2426
d6_send_raw_packet                                     -     428    +428
d6_send_kernel_packet                                  -     274    +274
d6_recv_raw_packet                                     -     248    +248
send_d6_discover                                       -     177    +177
packed_usage                                       28795   28966    +171
d6_run_script                                          -     156    +156
send_d6_renew                                          -     140    +140
send_d6_release                                        -     126    +126
d6_recv_kernel_packet                                  -     116    +116
send_d6_select                                         -      95     +95
perform_d6_release                                     -      78     +78
d6_find_option                                         -      74     +74
init_d6_packet                                         -      54     +54
d6_copy_option                                         -      48     +48
d6_mcast_from_client_config_ifindex                    -      42     +42
d6_dump_packet                                         -      24     +24
static.FF02__1_2                                       -      16     +16
d6_store_blob                                          -      13     +13
applet_names                                        2432    2440      +8
applet_main                                         1412    1416      +4
applet_nameofs                                       706     708      +2
add_d6_client_options                                  -       1      +1
------------------------------------------------------------------------------
(add/remove: 21/0 grow/shrink: 4/0 up/down: 4721/0)          Total: 4721 bytes
   text    data     bss     dec     hex filename
 879080     493    7584  887157   d8975 busybox_old
 884585     497    7584  892666   d9efa busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: trim help text, rename badly-named variable
Denys Vlasenko [Mon, 7 Nov 2011 14:44:46 +0000 (15:44 +0100)]
udhcpc: trim help text, rename badly-named variable

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: code shrink
Denys Vlasenko [Sun, 6 Nov 2011 23:54:27 +0000 (00:54 +0100)]
udhcpc: code shrink

function                                             old     new   delta
udhcpc_main                                         2646    2649      +3
udhcp_run_script                                     816     802     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: remove workaround for bugs in Win98 dhcp server ("MSFT 98" vendor string)
Denys Vlasenko [Sat, 5 Nov 2011 00:26:18 +0000 (01:26 +0100)]
udhcpc: remove workaround for bugs in Win98 dhcp server ("MSFT 98" vendor string)

Stats for last three commits:

function                                             old     new   delta
udhcpc_main                                         2635    2646     +11
udhcp_recv_raw_packet                                425     414     -11
udhcp_recv_kernel_packet                             210     134     -76
packed_usage                                       28940   28857     -83
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 11/-170)          Total: -159 bytes
   text    data     bss     dec     hex filename
 879524     493    7584  887601   d8b31 busybox_old
 879340     493    7584  887417   d8a79 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: reuse string constant; remove unneeded memset(0)
Denys Vlasenko [Sat, 5 Nov 2011 00:25:03 +0000 (01:25 +0100)]
udhcpc: reuse string constant; remove unneeded memset(0)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: deprecate --hostname NAME
Denys Vlasenko [Sat, 5 Nov 2011 00:24:14 +0000 (01:24 +0100)]
udhcpc: deprecate --hostname NAME

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolineedit: fix build failure
Denys Vlasenko [Fri, 4 Nov 2011 00:09:09 +0000 (01:09 +0100)]
lineedit: fix build failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolineedit: add support for M-b, M-f, M-d, M-Backspace
Denys Vlasenko [Thu, 3 Nov 2011 12:28:22 +0000 (13:28 +0100)]
lineedit: add support for M-b, M-f, M-d, M-Backspace

function                                             old     new   delta
ctrl_left                                              -      96     +96
ctrl_right                                             -      76     +76
static.esccmds                                        81      93     +12
read_line_input                                     3876    3885      +9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 193/0)             Total: 193 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoandroid build system updates
Daniel Fandrich [Thu, 3 Nov 2011 10:20:07 +0000 (11:20 +0100)]
android build system updates

Signed-off-by: Daniel Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agorx: code shrink
Denys Vlasenko [Thu, 3 Nov 2011 09:19:53 +0000 (10:19 +0100)]
rx: code shrink

function                                             old     new   delta
rx_main                                              961     947     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agorx: Fix file corruption with duplicate blocks
Dan Fandrich [Thu, 3 Nov 2011 09:18:33 +0000 (10:18 +0100)]
rx: Fix file corruption with duplicate blocks

Rather than dropping the dupe, rx was appending it to the file.

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomount: handle list of comma-separated fs types in -t option
Karol Lewandowski [Thu, 3 Nov 2011 09:02:31 +0000 (10:02 +0100)]
mount: handle list of comma-separated fs types in -t option

Allows one to specify list of filesystem types to be
tried when mounting particular device. E.g.

 mount -t vfat,ext2 ...
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomount: free commented /etc/filesystems lines when we read it
Denys Vlasenko [Thu, 3 Nov 2011 08:54:53 +0000 (09:54 +0100)]
mount: free commented /etc/filesystems lines when we read it

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonmeter: fix block i/o count on newer Linux kernels
Denys Vlasenko [Tue, 1 Nov 2011 22:34:46 +0000 (23:34 +0100)]
nmeter: fix block i/o count on newer Linux kernels

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agocttyhack: move /sys/class/tty/console/active check to the front
Denys Vlasenko [Mon, 31 Oct 2011 15:57:04 +0000 (16:57 +0100)]
cttyhack: move /sys/class/tty/console/active check to the front

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agocttyhack: print detected ctty name when called without parameters
Alexander Shishkin [Mon, 31 Oct 2011 12:18:44 +0000 (13:18 +0100)]
cttyhack: print detected ctty name when called without parameters

Sometimes there's a need to figure out the controlling tty from a shell
script, for example, to obtain a line for getty. In this case it's easier
to call cttyhack than trying to repeat some of the cttyhack's logic.

function                                             old     new   delta
cttyhack_main                                        283     327     +44
packed_usage                                       28911   28915      +4

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotestsuite: merge bzcat2.tests into bzcat.tests
Denys Vlasenko [Mon, 31 Oct 2011 00:10:47 +0000 (01:10 +0100)]
testsuite: merge bzcat2.tests into bzcat.tests

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotestsuite: fix the mishap in the previous commit
Denys Vlasenko [Mon, 31 Oct 2011 00:08:35 +0000 (01:08 +0100)]
testsuite: fix the mishap in the previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agobzcat: fix unpacking of more than one file, and unpacking of zero-size bz2. Closes...
Denys Vlasenko [Mon, 31 Oct 2011 00:05:16 +0000 (01:05 +0100)]
bzcat: fix unpacking of more than one file, and unpacking of zero-size bz2. Closes 4393

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomodinfo: make it select PLATFORM_LINUX. Closes 4411
Denys Vlasenko [Sun, 30 Oct 2011 21:07:36 +0000 (22:07 +0100)]
modinfo: make it select PLATFORM_LINUX. Closes 4411

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty: Hurd has no CBAUD, work around that
Denys Vlasenko [Sun, 30 Oct 2011 20:27:33 +0000 (21:27 +0100)]
getty: Hurd has no CBAUD, work around that

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomakemime: fix -a option not taking parameter
Denys Vlasenko [Fri, 28 Oct 2011 16:25:38 +0000 (18:25 +0200)]
makemime: fix -a option not taking parameter

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agosyslogd: work around rename() not renaming hardlinks to themselves
Christian Engelmayer [Fri, 28 Oct 2011 16:12:42 +0000 (18:12 +0200)]
syslogd: work around rename() not renaming hardlinks to themselves

Function log_locally() within the syslogd can potentially lock up when
restarting the daemon after a power loss in case the unplanned shutdown hit the
rename operation during logfile rotation.

While POSIX requires the rename operation to be atomic, many file systems such
as JFFS2 implement the rename operation in 2 steps by linking the new name
followed by unlinking the original name. In case of a power loss during the
rename the system can end up with /var/log/messages and /var/log/messages.0
being 2 hard links to the same file.

When the syslog daemon restarts in such a situation it will rediscover the need
to rotate the log files, however, POSIX also requires that rename does nothing
and reports success in case oldpath and newpath are existing hard links to the
same file. Looping through reopen: by (O_CREAT | O_APPEND), the daemon
eternally reopens the same file without succeeding to rotate.

Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolibbb: shrink base64 decoding a bit
Denys Vlasenko [Fri, 28 Oct 2011 14:15:00 +0000 (16:15 +0200)]
libbb: shrink base64 decoding a bit

function                                             old     new   delta
bb_uuenc_tbl_base64                                   67      66      -1
decode_base64                                        182     161     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agowhitespace fixes
Denys Vlasenko [Fri, 28 Oct 2011 12:07:44 +0000 (14:07 +0200)]
whitespace fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolibbb: split decode_base64 off read_base64
Leonid Lisovskiy [Fri, 28 Oct 2011 11:59:04 +0000 (13:59 +0200)]
libbb: split decode_base64 off read_base64

function                                             old     new   delta
decode_base64                                          -     182    +182
read_base64                                          378     255    -123
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 182/-123)           Total: 59 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolibbb.h: remove unused defines
Denys Vlasenko [Mon, 24 Oct 2011 02:06:18 +0000 (04:06 +0200)]
libbb.h: remove unused defines

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty: fix a minor problem of Ctrl-D not printing '\n'
Denys Vlasenko [Sun, 23 Oct 2011 21:58:59 +0000 (23:58 +0200)]
getty: fix a minor problem of Ctrl-D not printing '\n'

Also removed defines for control chars which are never changed,
and added login/getty README.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty: reset tty attrs on Ctrl-C and Ctrl-D too
Denys Vlasenko [Sun, 23 Oct 2011 16:05:58 +0000 (18:05 +0200)]
getty: reset tty attrs on Ctrl-C and Ctrl-D too

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty: add O_NONBLOCK to open which is used to drop ctty
Denys Vlasenko [Sat, 22 Oct 2011 06:19:42 +0000 (08:19 +0200)]
getty: add O_NONBLOCK to open which is used to drop ctty

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoremove duplicate include <sys/swap.h>
Denys Vlasenko [Sat, 22 Oct 2011 04:39:00 +0000 (06:39 +0200)]
remove duplicate include <sys/swap.h>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty: remove now not needed resetting of ALRM to to SIG_DFL
Denys Vlasenko [Sat, 22 Oct 2011 04:30:48 +0000 (06:30 +0200)]
getty: remove now not needed resetting of ALRM to to SIG_DFL

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty,login: tighten up handling of ctty, pgrp, and tty attr restoring on timeout
Denys Vlasenko [Sat, 22 Oct 2011 04:27:41 +0000 (06:27 +0200)]
getty,login: tighten up handling of ctty, pgrp, and tty attr restoring on timeout

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogetty: shrink help text
Denys Vlasenko [Sat, 22 Oct 2011 01:16:23 +0000 (03:16 +0200)]
getty: shrink help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agostty: trim too verbose error messages (-40 bytes)
Denys Vlasenko [Fri, 21 Oct 2011 17:45:13 +0000 (19:45 +0200)]
stty: trim too verbose error messages (-40 bytes)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agodocs/ctty.htm: add a useful URL to
Denys Vlasenko [Fri, 21 Oct 2011 16:44:33 +0000 (18:44 +0200)]
docs/ctty.htm: add a useful URL to

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: add comment about server IP
Denys Vlasenko [Thu, 20 Oct 2011 12:47:41 +0000 (14:47 +0200)]
udhcpc: add comment about server IP

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: in fill_envp, export BOOTP fields first
Denys Vlasenko [Thu, 20 Oct 2011 12:24:18 +0000 (14:24 +0200)]
udhcpc: in fill_envp, export BOOTP fields first

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agodhcpc: fix the case where we might add extra space at the end of envvar.
Denys Vlasenko [Thu, 20 Oct 2011 11:21:55 +0000 (13:21 +0200)]
dhcpc: fix the case where we might add extra space at the end of envvar.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: fix 6rd option formatting (was using 4 more bytes than there is)
Denys Vlasenko [Thu, 20 Oct 2011 10:29:18 +0000 (12:29 +0200)]
udhcpc: fix 6rd option formatting (was using 4 more bytes than there is)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: remove unused argument in sprint_nip6
Denys Vlasenko [Thu, 20 Oct 2011 08:52:07 +0000 (10:52 +0200)]
udhcpc: remove unused argument in sprint_nip6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: small code shrink
Denys Vlasenko [Thu, 20 Oct 2011 08:34:05 +0000 (10:34 +0200)]
udhcpc: small code shrink

function                                             old     new   delta
udhcp_recv_raw_packet                                430     425      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotypo fix in comment
Denys Vlasenko [Thu, 20 Oct 2011 06:54:16 +0000 (08:54 +0200)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: add support for DHCP option 212 (RFC 5969)
Denys Vlasenko [Wed, 19 Oct 2011 20:40:35 +0000 (22:40 +0200)]
udhcpc: add support for DHCP option 212 (RFC 5969)

The patch is from OpenWRT people.

function                                             old     new   delta
xmalloc_optname_optval                               637     874    +237
dhcp_option_strings                                  237     243      +6
dhcp_optflags                                         68      70      +2
len_of_option_as_string                               12      13      +1
dhcp_option_lengths                                   12      13      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 247/0)             Total: 247 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonc: small code shrink
Denys Vlasenko [Wed, 19 Oct 2011 20:31:01 +0000 (22:31 +0200)]
nc: small code shrink

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogen_build_files.sh: simplify "print everything up to INSERT line" part
Denys Vlasenko [Wed, 19 Oct 2011 19:17:20 +0000 (21:17 +0200)]
gen_build_files.sh: simplify "print everything up to INSERT line" part

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agogen_build_files: don't pass 200k+ strings as params. Closes 4321
Denys Vlasenko [Wed, 19 Oct 2011 15:54:42 +0000 (17:54 +0200)]
gen_build_files: don't pass 200k+ strings as params. Closes 4321

Also removes one grep per generated file.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoget_header_tar: shrink 6->64 sign extension code
Denys Vlasenko [Wed, 19 Oct 2011 12:51:12 +0000 (14:51 +0200)]
get_header_tar: shrink 6->64 sign extension code

function                                             old     new   delta
getOctal                                             125     107     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoifupdown: code shrink
Denys Vlasenko [Wed, 19 Oct 2011 00:37:08 +0000 (02:37 +0200)]
ifupdown: code shrink

function                                             old     new   delta
keywords_up_down                                       -      43     +43
set_environ                                          371     259    -112
ifupdown_main                                       2194    2073    -121
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 43/-233)          Total: -190 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoifupdown: support post-up / pre-down hooks
Peter Korsgaard [Wed, 19 Oct 2011 00:35:54 +0000 (02:35 +0200)]
ifupdown: support post-up / pre-down hooks

function                                             old     new   delta
set_environ                                          330     371     +41
ifupdown_main                                       2156    2194     +38
iface_up                                              97     113     +16
iface_down                                            97     113     +16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 111/0)             Total: 111 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoTODO: all another location with bbox patches (OpenWRT)
Denys Vlasenko [Tue, 18 Oct 2011 23:55:08 +0000 (01:55 +0200)]
TODO: all another location with bbox patches (OpenWRT)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agouudecode: fix buggy check for empty filename
Denys Vlasenko [Tue, 18 Oct 2011 10:07:05 +0000 (12:07 +0200)]
uudecode: fix buggy check for empty filename

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc: on SIGUSR1, limit renew attempts time to 20 seconds; then do total reconfig
Vladislav Grishenko [Mon, 17 Oct 2011 23:37:47 +0000 (01:37 +0200)]
udhcpc: on SIGUSR1, limit renew attempts time to 20 seconds; then do total reconfig

Scenario:

1. udhcpc gets lease for 86400 secs and sleeps for 43200 before renew attempt

2. PC gets physically disconnected and connected to another network

3. some phy control software sends SIGUSR1 to renew the lease, SIGUSR2 isn't
used because newly connected network could be the same as before

4. udhcpc sends unicast renew requests until lease timeout fall to 60 sec.
They are ignored by new network dhcp servers

5. udhcpc sends broadcast rebind requests for 60 seconds, which are NAKed
or ignored too

6. udhcpc deconfigs and starting from discover state, gets new lease for the
new network

So, pt.4+5 it could take up to 86400 secs without correct lease, which is
too long and not acceptable.

Second SIGUSR1 will immediately run into deconfig/discover state, which is
not preferable in case of the same subnet replugged.

This patch makes sure after SIGUSR1 timeout is no more than -A NUM
(usually 20 sec). It means that renew will be requested via broadcast,
and if no replies come back, full deconf/reconf cycle will be initiated
in 20 seconds.

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>