mdev: use $DEVNAME in uevent sysfs file for device node name

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

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

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
find: support -HLP

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Fix build failures caused by not compiling open_transformer.c (#2)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
grep: don't bail out on first mismatch if '-w' option is set

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
volume_id_internal.h: drop unoptimized byteswap routines

function                                             old     new   delta
volume_id_probe_hfs_hfsplus                          802     627    -175

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
grep: fix grep -x to not set REG_NOSUB

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

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

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Natanael Copa <ncopa@alpinelinux.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
find:: get rid of nested function (it's a gcc-ism)

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
udhcpc: fix a problem with binary-encoded options #2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
udhcp: code shrink

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
stty: code shrink

function                                             old     new   delta
set_mode                                             759     725     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
stty: disable CIBAUD leak check - it is not necessary on Linux

function                                             old     new   delta
stty_main                                           1233    1196     -37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
init: remove special-case code for machines with less tham 1 MB of RAM.

function                                             old     new   delta
init_main                                            920     781    -139

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sulogin: correct lying comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sulogin: allow system maintenance login if root password is empty

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

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

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: drop delay outliers; run "unsync" handler if no replies for some time

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: make "unsync" code actually work.

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: set G.last_script_run even if script isn't configured

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
ntpd: set offset to 0.0 in "usync" event

function                                             old     new   delta
ntpd_main                                           1030    1026      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
pstree: stop truncating thread names

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

Reported-by: Dag Wieers <dag@wieers.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
md5/sha512: fix strict aliasing warnings

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

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

Signed-off-by: Mike Frysinger <vapier@gentoo.org>