vasprintf: do not use xmalloc, it will deadlock on OOM

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
vasprintf: return -1 on strdup failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
fdisk_sun: fix corrupted partition data with blank disk

After creating Sun disk label for the first time for a blank disk,
the partition table appears corrupted because current_label_type will
never get set to a proper type. Fix this by calling check_sun_label()
after BusyBox has created the label.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
fdisk_sun: fix partition alignment

When the display unit is sectors, the partition alignment will convert
the partition start to a wrong unit (it should always be in sectors). Fix
this.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
rpm: make -ql display more compatible; improve help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
rpm: use "create+rename" method of replacing existing files

Users were reporting getting errors like
"ls: error while loading shared libraries: libc.so.6: ELF load command past end of file"
while rpm was unpacking glibc tarball.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
rpm: stop using statics; move main() to the end of the source file

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
rpm: unmap rpm file before working with next one

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
head,tail: use common suffix struct. simplify help text.

function                                             old     new   delta
head_tail_suffixes                                     -      32     +32
head_main                                            415     406      -9
packed_usage                                       29252   29234     -18
tail_suffixes                                         32       -     -32
head_suffixes                                         32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/2 up/down: 32/-91)            Total: -59 bytes
   text    data     bss     dec     hex filename
 890474     497    7584  898555   db5fb busybox_old
 890415     497    7584  898496   db5c0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
head: support -n -NUM and -c -NUM

function                                             old     new   delta
head_main                                            406     832    +426
packed_usage                                       29234   29252     +18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 444/0)             Total: 444 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
tail: make help text for -n +N syntax more correct

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
move endofname() to libbb

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
mdev: add environment variable match

function                                             old     new   delta
make_device                                         1998    2189    +191
clean_up_cur_rule                                     61      96     +35
dirAction                                             75      87     +12
mdev_main                                            838     849     +11
packed_usage                                       29272   29273      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 250/0)             Total: 250 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
udhcpc: support resolv.conf symlinks

Often it is desirable to have /etc/ be on read-only storage (well, the
whole rootfs) but have things like /etc/resolv.conf be symlinks to a
writable location.  Tweak the simple script to support that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
udhcpc: tweak math shell style with the metric var

Some shells (like dash) are lame and omit the POSIX increment/decrement
feature (because it is listed as optional).  Tweak the shell script to
work in all POSIX variants.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
mdev: improve $SEQ handling; improve debug logging

Sequential run of concurrent mdev's was too simplistic:
they waited for /dev/mdev.seq to match. This could sometimes
cause cumulative loss of time on the order of a second.

Added SIGCHLD signaling from exiting mdev to all other mdev's.
Added debugging required to see that code actually works as intended.

Example of /dev/mdev.log (with "woken up" elevated from dbg lvl 3 to 2):

mdev[1023]: first seq written
     ^^^^ seq, not pid
mdev[1023]: 35.022395 ACTION:add SUBSYSTEM:module DEVNAME:(null) DEVPATH:/module/lib80211
mdev[1023]: rule matched, line -1
                          ^^^^^^^ means "default rule"
mdev[1023]: 35.022676 exiting
            ^^^^^^^^^ second,usec timestamp
mdev[1024]: 35.069691 ACTION:add SUBSYSTEM:vc DEVNAME:vcs9 DEVPATH:/devices/virtual/vc/vcs9
mdev[1024]: dev 7,9
mdev[1025]: 35.069889 waiting for '1024'
mdev[1026]: 35.069946 waiting for '1024'
mdev[1027]: 35.070151 waiting for '1024'
mdev[1024]: rule matched, line -1
mdev[1024]: mknod vcs9 (7,9) 20660 0:0
mdev[1024]: 35.070346 exiting
mdev[1025]: woken up
mdev[1026]: woken up
mdev[1025]: 35.071213 ACTION:add SUBSYSTEM:vc DEVNAME:vcsa9 DEVPATH:/devices/virtual/vc/vcsa9
            ^^^^^^^^^ took only a millisecond to start running after prev mdev exited
mdev[1025]: dev 7,137
mdev[1027]: woken up
mdev[1025]: rule matched, line -1
mdev[1025]: mknod vcsa9 (7,137) 20660 0:0
mdev[1025]: 35.072109 exiting

function                                             old     new   delta
mdev_main                                            849    1372    +523
curtime                                                -      59     +59
dirAction                                             87     134     +47
static.ts                                              -       8      +8
keywords                                              19      12      -7
make_device                                         2189    2119     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Fix move_to_unaligned16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
xz: omit explicit \0 from HEADER_MAGIC

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
xz: update README

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
xz: avoid "NOTE:" in xz.h

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>