The xsocket_type() function had an optional "family" argument
that was enabled only if IPv6 is enabled. In the case of the
function was called with a valid AF_UNIX argument, and IPv6 is
disabled, this argument was silently ignored.
This patch makes the "family" argument mandatory, while keeping
the old behavior i.e., if AF_UNSPEC is passed, we try first IPv6
(if it's enabled) and fallback to IPv4.
Also I changed all callers of xsocket_type() to reflect its new
interface.
Signed-off-by: Jonh Wendell <jonh.wendell@vexcorp.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This allows to find mount points of 'char' devices such as UBI volumes
which otherwise fail for example with 'df' command:
/ # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 72091984 12360980 56068924 18% /
devtmpfs 115236 4 115232 0% /dev
tmpfs 28672 32 28640 0% /tmp
/dev/ubi0_0 360268 18348 341920 5% /tmp/mnt/userfs
/ # df /dev/ubi0_0
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 115236 4 115232 0% /dev
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
First change fixes "read -n NUM". Apparently poll() won't report
data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes.
function old new delta
read_line_input 3885 3877 -8
shell_builtin_read 1097 1087 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
function old new delta
die_if_bad_username 77 97 +20
Based on patches from Tito.
The changes are:
better comments
we disallow '@' now - in practice such usernames will be unusable
use of the portable filename character set plus '$'
don't use isalnum as it allows non-ASCII letters in legacy 8-bit locales (pointed out by Rich Felker)
enforce maximum length of LOGIN_NAME_MAX (including NUL)
don't allow '$', '.', and '-' as first char
don't print the illegal char in error message as if it is a wide char it will be unreadable
print the position of the illegal character
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This also moves bb_get_chunk_with_continuation into its sole user,
parse_config.c.
This allows to optimize both functions separately,
they need to be optimized for speed.
(this need was highlighted by slow modprobe caused in part by slow
bb_get_chunk_with_continuation in config parser).
function old new delta
bb_get_chunk_from_file 7 130 +123
config_read 457 558 +101
bb_get_chunk_with_continuation 194 - -194
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/0 up/down: 224/-194) Total: 30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When compiling with !ENABLE_FEATURE_GETOPT_LONG, busybox still tries
to include getopt.h which is not available; for example with uClibc
when !UCLIBC_HAS_GETOPT_LONG. getopt.h is only required
for the _long set of functions.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>