summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2020-12-29 16:53:11 +0100
committerDenys Vlasenko2020-12-29 16:53:11 +0100
commit77a51a2709de1b646ab493f0bf771d896de6efc2 (patch)
treed0e44b91d8391ca06d4de3f7d5101da76c4f940e
parentc7ef8187688b0e7f92d19b3fed2c4ecffe39a688 (diff)
downloadbusybox-77a51a2709de1b646ab493f0bf771d896de6efc2.zip
busybox-77a51a2709de1b646ab493f0bf771d896de6efc2.tar.gz
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/procps.c2
-rw-r--r--loginutils/login.c4
-rw-r--r--miscutils/dc.c2
-rw-r--r--miscutils/devfsd.c4
-rw-r--r--miscutils/i2c_tools.c6
-rw-r--r--networking/libiproute/ipaddress.c6
-rw-r--r--networking/telnet.c4
-rw-r--r--networking/traceroute.c2
-rw-r--r--runit/runsv.c18
-rw-r--r--shell/hush.c4
-rwxr-xr-xtestsuite/mount.tests2
-rwxr-xr-xtestsuite/xargs.tests2
-rw-r--r--util-linux/fdisk.c7
13 files changed, 45 insertions, 18 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 975e0d4..7596994 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -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)
{
diff --git a/loginutils/login.c b/loginutils/login.c
index de05631..21c32fc 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -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
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 51376dd..e94dc39 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -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;
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 17d8fb6..e5bb8a2 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -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';
}
@@ -1106,7 +1106,7 @@ static int copy_inode(const char *destpath, const struct stat *dest_stat,
do_chown:
if (chown(destpath, source_stat->st_uid, source_stat->st_gid) == 0)
return TRUE;
- /*break;*/
+ /*break;*/
}
return FALSE;
} /* End Function copy_inode */
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 57cac5d..cda17ee 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -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)
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index 71e8fb6..91fabb1 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -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 */
diff --git a/networking/telnet.c b/networking/telnet.c
index 19a414b..7a02535 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -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)
{
diff --git a/networking/traceroute.c b/networking/traceroute.c
index ec3ac8b..3f1a9ab 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -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;
diff --git a/runit/runsv.c b/runit/runsv.c
index 7e22862..d395d45 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -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));
- /* Cheat */
- gettimeofday((void*)ts, NULL);
- ts->tv_nsec *= 1000;
+ 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
diff --git a/shell/hush.c b/shell/hush.c
index f5cbbc3..9fead37 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -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!
diff --git a/testsuite/mount.tests b/testsuite/mount.tests
index 91c2e8b..b6d5ebe 100755
--- a/testsuite/mount.tests
+++ b/testsuite/mount.tests
@@ -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 "\
diff --git a/testsuite/xargs.tests b/testsuite/xargs.tests
index e7c7c4b..c5e7b99 100755
--- a/testsuite/xargs.tests
+++ b/testsuite/xargs.tests
@@ -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" \
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 6454baa..c50ceea 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -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 {