randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2020-12-29 16:53:11 +01:00
parent c7ef818768
commit 77a51a2709
13 changed files with 45 additions and 18 deletions

View File

@ -177,6 +177,7 @@ static char *skip_fields(char *str, int count)
}
#endif
#if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP
static char* skip_whitespace_if_prefixed_with(char *buf, const char *prefix)
{
char *tp = is_prefixed_with(buf, prefix);
@ -186,7 +187,6 @@ static char* skip_whitespace_if_prefixed_with(char *buf, const char *prefix)
return tp;
}
#if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP
int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
void (*cb)(struct smaprec *, void *), void *data)
{

View File

@ -341,7 +341,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
#if ENABLE_LOGIN_SESSION_AS_CHILD
pid_t child_pid;
#endif
pid_t my_pid;
IF_FEATURE_UTMP(pid_t my_pid;)
INIT_G();
@ -524,7 +524,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
if (pw->pw_uid != 0)
die_if_nologin();
my_pid = getpid();
IF_FEATURE_UTMP(my_pid = getpid();)
update_utmp(my_pid, USER_PROCESS, short_tty, username, run_by_root ? opt_host : NULL);
#if ENABLE_LOGIN_SESSION_AS_CHILD

View File

@ -100,7 +100,7 @@ static void mod(void)
* 0
*/
if (d == 0) {
bb_error_msg("remainder by zero");
bb_simple_error_msg("remainder by zero");
pop();
push(0);
return;

View File

@ -362,7 +362,7 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
static void safe_memcpy(char *dest, const char *src, int len)
{
memcpy(dest , src, len);
memcpy(dest, src, len);
dest[len] = '\0';
}

View File

@ -273,7 +273,7 @@ static int i2c_bus_lookup(const char *bus_str)
return xstrtou_range(bus_str, 10, 0, 0xfffff);
}
#if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP || ENABLE_I2CTRANSFER
#if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP
static int i2c_parse_bus_addr(const char *addr_str)
{
/* Slave address must be in range 0x03 - 0x77. */
@ -286,14 +286,16 @@ static void i2c_set_pec(int fd, int pec)
itoptr(pec ? 1 : 0),
"can't set PEC");
}
#endif
#if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP || ENABLE_I2CTRANSFER
static void i2c_set_slave_addr(int fd, int addr, int force)
{
ioctl_or_perror_and_die(fd, force ? I2C_SLAVE_FORCE : I2C_SLAVE,
itoptr(addr),
"can't set address to 0x%02x", addr);
}
#endif /* ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP */
#endif
#if ENABLE_I2CGET || ENABLE_I2CSET
static int i2c_parse_data_addr(const char *data_addr)

View File

@ -21,6 +21,12 @@
#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
#endif
#ifndef IFA_F_NOPREFIXROUTE
# define IFA_FLAGS 8
/* ifa_flags */
# define IFA_F_NOPREFIXROUTE 0x200
#endif
struct filter_t {
char *label;
/* Flush cmd buf. If !NULL, print_addrinfo() constructs flush commands in it */

View File

@ -368,12 +368,16 @@ static void put_iac2_msb_lsb(unsigned x_y)
}
#define put_iac2_x_y(x,y) put_iac2_msb_lsb(((x)<<8) + (y))
#if ENABLE_FEATURE_TELNET_WIDTH \
|| ENABLE_FEATURE_TELNET_TTYPE \
|| ENABLE_FEATURE_TELNET_AUTOLOGIN
static void put_iac4_msb_lsb(unsigned x_y_z_t)
{
put_iac2_msb_lsb(x_y_z_t >> 16);
put_iac2_msb_lsb(x_y_z_t); /* "... & 0xffff" is implicit */
}
#define put_iac4_x_y_z_t(x,y,z,t) put_iac4_msb_lsb(((x)<<24) + ((y)<<16) + ((z)<<8) + (t))
#endif
static void put_iac3_IAC_x_y_merged(unsigned wwdd_and_c)
{

View File

@ -483,7 +483,7 @@ wait_for_reply(unsigned *timestamp_us, int *left_ms)
&G.from_lsa->u.sa, &G.from_lsa->len);
#endif
if (read_len < 0)
bb_perror_msg_and_die("recv");
bb_simple_perror_msg_and_die("recv");
t = monotonic_us();
*left_ms -= (t - *timestamp_us) / 1000;
*timestamp_us = t;

View File

@ -58,11 +58,19 @@ static void gettimeofday_ns(struct timespec *ts)
#else
static void gettimeofday_ns(struct timespec *ts)
{
BUILD_BUG_ON(sizeof(struct timeval) != sizeof(struct timespec));
BUILD_BUG_ON(sizeof(((struct timeval*)ts)->tv_usec) != sizeof(ts->tv_nsec));
if (sizeof(struct timeval) == sizeof(struct timespec)
&& sizeof(((struct timeval*)ts)->tv_usec) == sizeof(ts->tv_nsec)
) {
/* Cheat */
gettimeofday((void*)ts, NULL);
ts->tv_nsec *= 1000;
} else {
/* For example, musl has "incompatible" layouts */
struct timeval tv;
gettimeofday(&tv, NULL);
ts->tv_sec = tv.tv_sec;
ts->tv_nsec = tv.tv_usec * 1000;
}
}
#endif

View File

@ -653,7 +653,7 @@ struct command {
/* used for "[[ EXPR ]]" */
# define CMD_TEST2_SINGLEWORD_NOGLOB 2
#endif
#if ENABLE_HUSH_LOCAL || ENABLE_HUSH_EXPORT || ENABLE_HUSH_READONLY
#if BASH_TEST2 || ENABLE_HUSH_LOCAL || ENABLE_HUSH_EXPORT || ENABLE_HUSH_READONLY
/* used to prevent word splitting and globbing in "export v=t*" */
# define CMD_SINGLEWORD_NOGLOB 3
#endif
@ -8762,6 +8762,7 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status)
*/
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
#if ENABLE_HUSH_JOB
if (G.run_list_level == 1
/* ^^^^^ Do not print in nested contexts, example:
* echo `sleep 1; sh -c 'kill -9 $$'` - prints "137", NOT "Killed 137"
@ -8771,6 +8772,7 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status)
/* strsignal() is for bash compat. ~600 bloat versus bbox's get_signame() */
puts(sig == SIGINT || sig == SIGPIPE ? "" : strsignal(sig));
}
#endif
/* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */
/* MIPS has 128 sigs (1..128), if sig==128,
* 128 + sig would result in exitcode 256 -> 0!

View File

@ -34,6 +34,8 @@ umount -d "$testdir" 2>/dev/null
# file input will be file called "input"
# test can create a file "actual" instead of writing to stdout
# This will always fail on !CONFIG_MANDATORY_FILE_LOCKING kernels
test "$SKIP_MOUNT_MAND_TESTS" = "1" || \
testing "mount -o remount,mand" \
"mount -o loop mount.image1m $testdir "\
"&& grep -Fc $testdir </proc/mounts "\

View File

@ -61,7 +61,7 @@ testing "xargs -n2" \
SKIP=
optional FEATURE_XARGS_SUPPORT_QUOTES
optional FEATURE_XARGS_SUPPORT_QUOTES FEATURE_XARGS_SUPPORT_REPL_STR
testing "xargs -I skips empty lines and leading whitespace" \
"xargs -I% echo '[%]'" \
"[2]\n[4]\n[6 6 ]\n[7]\n" \

View File

@ -185,8 +185,11 @@ struct hd_geometry {
#define HDIO_GETGEO 0x0301 /* get device geometry */
/* TODO: #if ENABLE_FEATURE_FDISK_WRITABLE */
/* TODO: just #if ENABLE_FEATURE_FDISK_WRITABLE */
/* (currently fdisk_sun/sgi.c do not have proper WRITABLE #ifs) */
#if ENABLE_FEATURE_FDISK_WRITABLE \
|| ENABLE_FEATURE_SGI_LABEL \
|| ENABLE_FEATURE_SUN_LABEL
static const char msg_building_new_label[] ALIGN1 =
"Building a new %s. Changes will remain in memory only,\n"
"until you decide to write them. After that the previous content\n"
@ -194,7 +197,7 @@ static const char msg_building_new_label[] ALIGN1 =
static const char msg_part_already_defined[] ALIGN1 =
"Partition %u is already defined, delete it before re-adding\n";
/* #endif */
#endif
struct partition {