diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-29 16:53:11 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-29 16:53:11 +0100 |
commit | 77a51a2709de1b646ab493f0bf771d896de6efc2 (patch) | |
tree | d0e44b91d8391ca06d4de3f7d5101da76c4f940e | |
parent | c7ef8187688b0e7f92d19b3fed2c4ecffe39a688 (diff) | |
download | busybox-77a51a2709de1b646ab493f0bf771d896de6efc2.tar.gz |
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/procps.c | 2 | ||||
-rw-r--r-- | loginutils/login.c | 4 | ||||
-rw-r--r-- | miscutils/dc.c | 2 | ||||
-rw-r--r-- | miscutils/devfsd.c | 4 | ||||
-rw-r--r-- | miscutils/i2c_tools.c | 6 | ||||
-rw-r--r-- | networking/libiproute/ipaddress.c | 6 | ||||
-rw-r--r-- | networking/telnet.c | 4 | ||||
-rw-r--r-- | networking/traceroute.c | 2 | ||||
-rw-r--r-- | runit/runsv.c | 18 | ||||
-rw-r--r-- | shell/hush.c | 4 | ||||
-rwxr-xr-x | testsuite/mount.tests | 2 | ||||
-rwxr-xr-x | testsuite/xargs.tests | 2 | ||||
-rw-r--r-- | util-linux/fdisk.c | 7 |
13 files changed, 45 insertions, 18 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index 975e0d4dc..75969947b 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 de05631d2..21c32fc25 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 51376dd75..e94dc39e0 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 17d8fb6b9..e5bb8a2d8 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 57cac5d47..cda17ee00 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 71e8fb6a7..91fabb1fd 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 19a414b30..7a0253525 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 ec3ac8b6f..3f1a9ab46 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 7e22862cd..d395d4528 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 f5cbbc39f..9fead37da 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 91c2e8b42..b6d5ebe08 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 e7c7c4b3d..c5e7b99e9 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 6454baab8..c50ceead1 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 { |