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-w32-77a51a2709de1b646ab493f0bf771d896de6efc2.tar.gz busybox-w32-77a51a2709de1b646ab493f0bf771d896de6efc2.tar.bz2 busybox-w32-77a51a2709de1b646ab493f0bf771d896de6efc2.zip |
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) | |||
177 | } | 177 | } |
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | #if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP | ||
180 | static char* skip_whitespace_if_prefixed_with(char *buf, const char *prefix) | 181 | static char* skip_whitespace_if_prefixed_with(char *buf, const char *prefix) |
181 | { | 182 | { |
182 | char *tp = is_prefixed_with(buf, prefix); | 183 | char *tp = is_prefixed_with(buf, prefix); |
@@ -186,7 +187,6 @@ static char* skip_whitespace_if_prefixed_with(char *buf, const char *prefix) | |||
186 | return tp; | 187 | return tp; |
187 | } | 188 | } |
188 | 189 | ||
189 | #if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP | ||
190 | int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | 190 | int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, |
191 | void (*cb)(struct smaprec *, void *), void *data) | 191 | void (*cb)(struct smaprec *, void *), void *data) |
192 | { | 192 | { |
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) | |||
341 | #if ENABLE_LOGIN_SESSION_AS_CHILD | 341 | #if ENABLE_LOGIN_SESSION_AS_CHILD |
342 | pid_t child_pid; | 342 | pid_t child_pid; |
343 | #endif | 343 | #endif |
344 | pid_t my_pid; | 344 | IF_FEATURE_UTMP(pid_t my_pid;) |
345 | 345 | ||
346 | INIT_G(); | 346 | INIT_G(); |
347 | 347 | ||
@@ -524,7 +524,7 @@ int login_main(int argc UNUSED_PARAM, char **argv) | |||
524 | if (pw->pw_uid != 0) | 524 | if (pw->pw_uid != 0) |
525 | die_if_nologin(); | 525 | die_if_nologin(); |
526 | 526 | ||
527 | my_pid = getpid(); | 527 | IF_FEATURE_UTMP(my_pid = getpid();) |
528 | update_utmp(my_pid, USER_PROCESS, short_tty, username, run_by_root ? opt_host : NULL); | 528 | update_utmp(my_pid, USER_PROCESS, short_tty, username, run_by_root ? opt_host : NULL); |
529 | 529 | ||
530 | #if ENABLE_LOGIN_SESSION_AS_CHILD | 530 | #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) | |||
100 | * 0 | 100 | * 0 |
101 | */ | 101 | */ |
102 | if (d == 0) { | 102 | if (d == 0) { |
103 | bb_error_msg("remainder by zero"); | 103 | bb_simple_error_msg("remainder by zero"); |
104 | pop(); | 104 | pop(); |
105 | push(0); | 105 | push(0); |
106 | return; | 106 | 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"; | |||
362 | 362 | ||
363 | static void safe_memcpy(char *dest, const char *src, int len) | 363 | static void safe_memcpy(char *dest, const char *src, int len) |
364 | { | 364 | { |
365 | memcpy(dest , src, len); | 365 | memcpy(dest, src, len); |
366 | dest[len] = '\0'; | 366 | dest[len] = '\0'; |
367 | } | 367 | } |
368 | 368 | ||
@@ -1106,7 +1106,7 @@ static int copy_inode(const char *destpath, const struct stat *dest_stat, | |||
1106 | do_chown: | 1106 | do_chown: |
1107 | if (chown(destpath, source_stat->st_uid, source_stat->st_gid) == 0) | 1107 | if (chown(destpath, source_stat->st_uid, source_stat->st_gid) == 0) |
1108 | return TRUE; | 1108 | return TRUE; |
1109 | /*break;*/ | 1109 | /*break;*/ |
1110 | } | 1110 | } |
1111 | return FALSE; | 1111 | return FALSE; |
1112 | } /* End Function copy_inode */ | 1112 | } /* 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) | |||
273 | return xstrtou_range(bus_str, 10, 0, 0xfffff); | 273 | return xstrtou_range(bus_str, 10, 0, 0xfffff); |
274 | } | 274 | } |
275 | 275 | ||
276 | #if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP || ENABLE_I2CTRANSFER | 276 | #if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP |
277 | static int i2c_parse_bus_addr(const char *addr_str) | 277 | static int i2c_parse_bus_addr(const char *addr_str) |
278 | { | 278 | { |
279 | /* Slave address must be in range 0x03 - 0x77. */ | 279 | /* Slave address must be in range 0x03 - 0x77. */ |
@@ -286,14 +286,16 @@ static void i2c_set_pec(int fd, int pec) | |||
286 | itoptr(pec ? 1 : 0), | 286 | itoptr(pec ? 1 : 0), |
287 | "can't set PEC"); | 287 | "can't set PEC"); |
288 | } | 288 | } |
289 | #endif | ||
289 | 290 | ||
291 | #if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP || ENABLE_I2CTRANSFER | ||
290 | static void i2c_set_slave_addr(int fd, int addr, int force) | 292 | static void i2c_set_slave_addr(int fd, int addr, int force) |
291 | { | 293 | { |
292 | ioctl_or_perror_and_die(fd, force ? I2C_SLAVE_FORCE : I2C_SLAVE, | 294 | ioctl_or_perror_and_die(fd, force ? I2C_SLAVE_FORCE : I2C_SLAVE, |
293 | itoptr(addr), | 295 | itoptr(addr), |
294 | "can't set address to 0x%02x", addr); | 296 | "can't set address to 0x%02x", addr); |
295 | } | 297 | } |
296 | #endif /* ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP */ | 298 | #endif |
297 | 299 | ||
298 | #if ENABLE_I2CGET || ENABLE_I2CSET | 300 | #if ENABLE_I2CGET || ENABLE_I2CSET |
299 | static int i2c_parse_data_addr(const char *data_addr) | 301 | 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 @@ | |||
21 | #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ | 21 | #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #ifndef IFA_F_NOPREFIXROUTE | ||
25 | # define IFA_FLAGS 8 | ||
26 | /* ifa_flags */ | ||
27 | # define IFA_F_NOPREFIXROUTE 0x200 | ||
28 | #endif | ||
29 | |||
24 | struct filter_t { | 30 | struct filter_t { |
25 | char *label; | 31 | char *label; |
26 | /* Flush cmd buf. If !NULL, print_addrinfo() constructs flush commands in it */ | 32 | /* 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) | |||
368 | } | 368 | } |
369 | #define put_iac2_x_y(x,y) put_iac2_msb_lsb(((x)<<8) + (y)) | 369 | #define put_iac2_x_y(x,y) put_iac2_msb_lsb(((x)<<8) + (y)) |
370 | 370 | ||
371 | #if ENABLE_FEATURE_TELNET_WIDTH \ | ||
372 | || ENABLE_FEATURE_TELNET_TTYPE \ | ||
373 | || ENABLE_FEATURE_TELNET_AUTOLOGIN | ||
371 | static void put_iac4_msb_lsb(unsigned x_y_z_t) | 374 | static void put_iac4_msb_lsb(unsigned x_y_z_t) |
372 | { | 375 | { |
373 | put_iac2_msb_lsb(x_y_z_t >> 16); | 376 | put_iac2_msb_lsb(x_y_z_t >> 16); |
374 | put_iac2_msb_lsb(x_y_z_t); /* "... & 0xffff" is implicit */ | 377 | put_iac2_msb_lsb(x_y_z_t); /* "... & 0xffff" is implicit */ |
375 | } | 378 | } |
376 | #define put_iac4_x_y_z_t(x,y,z,t) put_iac4_msb_lsb(((x)<<24) + ((y)<<16) + ((z)<<8) + (t)) | 379 | #define put_iac4_x_y_z_t(x,y,z,t) put_iac4_msb_lsb(((x)<<24) + ((y)<<16) + ((z)<<8) + (t)) |
380 | #endif | ||
377 | 381 | ||
378 | static void put_iac3_IAC_x_y_merged(unsigned wwdd_and_c) | 382 | static void put_iac3_IAC_x_y_merged(unsigned wwdd_and_c) |
379 | { | 383 | { |
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) | |||
483 | &G.from_lsa->u.sa, &G.from_lsa->len); | 483 | &G.from_lsa->u.sa, &G.from_lsa->len); |
484 | #endif | 484 | #endif |
485 | if (read_len < 0) | 485 | if (read_len < 0) |
486 | bb_perror_msg_and_die("recv"); | 486 | bb_simple_perror_msg_and_die("recv"); |
487 | t = monotonic_us(); | 487 | t = monotonic_us(); |
488 | *left_ms -= (t - *timestamp_us) / 1000; | 488 | *left_ms -= (t - *timestamp_us) / 1000; |
489 | *timestamp_us = t; | 489 | *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) | |||
58 | #else | 58 | #else |
59 | static void gettimeofday_ns(struct timespec *ts) | 59 | static void gettimeofday_ns(struct timespec *ts) |
60 | { | 60 | { |
61 | BUILD_BUG_ON(sizeof(struct timeval) != sizeof(struct timespec)); | 61 | if (sizeof(struct timeval) == sizeof(struct timespec) |
62 | BUILD_BUG_ON(sizeof(((struct timeval*)ts)->tv_usec) != sizeof(ts->tv_nsec)); | 62 | && sizeof(((struct timeval*)ts)->tv_usec) == sizeof(ts->tv_nsec) |
63 | /* Cheat */ | 63 | ) { |
64 | gettimeofday((void*)ts, NULL); | 64 | /* Cheat */ |
65 | ts->tv_nsec *= 1000; | 65 | gettimeofday((void*)ts, NULL); |
66 | ts->tv_nsec *= 1000; | ||
67 | } else { | ||
68 | /* For example, musl has "incompatible" layouts */ | ||
69 | struct timeval tv; | ||
70 | gettimeofday(&tv, NULL); | ||
71 | ts->tv_sec = tv.tv_sec; | ||
72 | ts->tv_nsec = tv.tv_usec * 1000; | ||
73 | } | ||
66 | } | 74 | } |
67 | #endif | 75 | #endif |
68 | 76 | ||
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 { | |||
653 | /* used for "[[ EXPR ]]" */ | 653 | /* used for "[[ EXPR ]]" */ |
654 | # define CMD_TEST2_SINGLEWORD_NOGLOB 2 | 654 | # define CMD_TEST2_SINGLEWORD_NOGLOB 2 |
655 | #endif | 655 | #endif |
656 | #if ENABLE_HUSH_LOCAL || ENABLE_HUSH_EXPORT || ENABLE_HUSH_READONLY | 656 | #if BASH_TEST2 || ENABLE_HUSH_LOCAL || ENABLE_HUSH_EXPORT || ENABLE_HUSH_READONLY |
657 | /* used to prevent word splitting and globbing in "export v=t*" */ | 657 | /* used to prevent word splitting and globbing in "export v=t*" */ |
658 | # define CMD_SINGLEWORD_NOGLOB 3 | 658 | # define CMD_SINGLEWORD_NOGLOB 3 |
659 | #endif | 659 | #endif |
@@ -8762,6 +8762,7 @@ static int process_wait_result(struct pipe *fg_pipe, pid_t childpid, int status) | |||
8762 | */ | 8762 | */ |
8763 | if (WIFSIGNALED(status)) { | 8763 | if (WIFSIGNALED(status)) { |
8764 | int sig = WTERMSIG(status); | 8764 | int sig = WTERMSIG(status); |
8765 | #if ENABLE_HUSH_JOB | ||
8765 | if (G.run_list_level == 1 | 8766 | if (G.run_list_level == 1 |
8766 | /* ^^^^^ Do not print in nested contexts, example: | 8767 | /* ^^^^^ Do not print in nested contexts, example: |
8767 | * echo `sleep 1; sh -c 'kill -9 $$'` - prints "137", NOT "Killed 137" | 8768 | * 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) | |||
8771 | /* strsignal() is for bash compat. ~600 bloat versus bbox's get_signame() */ | 8772 | /* strsignal() is for bash compat. ~600 bloat versus bbox's get_signame() */ |
8772 | puts(sig == SIGINT || sig == SIGPIPE ? "" : strsignal(sig)); | 8773 | puts(sig == SIGINT || sig == SIGPIPE ? "" : strsignal(sig)); |
8773 | } | 8774 | } |
8775 | #endif | ||
8774 | /* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */ | 8776 | /* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */ |
8775 | /* MIPS has 128 sigs (1..128), if sig==128, | 8777 | /* MIPS has 128 sigs (1..128), if sig==128, |
8776 | * 128 + sig would result in exitcode 256 -> 0! | 8778 | * 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 | |||
34 | # file input will be file called "input" | 34 | # file input will be file called "input" |
35 | # test can create a file "actual" instead of writing to stdout | 35 | # test can create a file "actual" instead of writing to stdout |
36 | 36 | ||
37 | # This will always fail on !CONFIG_MANDATORY_FILE_LOCKING kernels | ||
38 | test "$SKIP_MOUNT_MAND_TESTS" = "1" || \ | ||
37 | testing "mount -o remount,mand" \ | 39 | testing "mount -o remount,mand" \ |
38 | "mount -o loop mount.image1m $testdir "\ | 40 | "mount -o loop mount.image1m $testdir "\ |
39 | "&& grep -Fc $testdir </proc/mounts "\ | 41 | "&& 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" \ | |||
61 | 61 | ||
62 | SKIP= | 62 | SKIP= |
63 | 63 | ||
64 | optional FEATURE_XARGS_SUPPORT_QUOTES | 64 | optional FEATURE_XARGS_SUPPORT_QUOTES FEATURE_XARGS_SUPPORT_REPL_STR |
65 | testing "xargs -I skips empty lines and leading whitespace" \ | 65 | testing "xargs -I skips empty lines and leading whitespace" \ |
66 | "xargs -I% echo '[%]'" \ | 66 | "xargs -I% echo '[%]'" \ |
67 | "[2]\n[4]\n[6 6 ]\n[7]\n" \ | 67 | "[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 { | |||
185 | 185 | ||
186 | #define HDIO_GETGEO 0x0301 /* get device geometry */ | 186 | #define HDIO_GETGEO 0x0301 /* get device geometry */ |
187 | 187 | ||
188 | /* TODO: #if ENABLE_FEATURE_FDISK_WRITABLE */ | 188 | /* TODO: just #if ENABLE_FEATURE_FDISK_WRITABLE */ |
189 | /* (currently fdisk_sun/sgi.c do not have proper WRITABLE #ifs) */ | 189 | /* (currently fdisk_sun/sgi.c do not have proper WRITABLE #ifs) */ |
190 | #if ENABLE_FEATURE_FDISK_WRITABLE \ | ||
191 | || ENABLE_FEATURE_SGI_LABEL \ | ||
192 | || ENABLE_FEATURE_SUN_LABEL | ||
190 | static const char msg_building_new_label[] ALIGN1 = | 193 | static const char msg_building_new_label[] ALIGN1 = |
191 | "Building a new %s. Changes will remain in memory only,\n" | 194 | "Building a new %s. Changes will remain in memory only,\n" |
192 | "until you decide to write them. After that the previous content\n" | 195 | "until you decide to write them. After that the previous content\n" |
@@ -194,7 +197,7 @@ static const char msg_building_new_label[] ALIGN1 = | |||
194 | 197 | ||
195 | static const char msg_part_already_defined[] ALIGN1 = | 198 | static const char msg_part_already_defined[] ALIGN1 = |
196 | "Partition %u is already defined, delete it before re-adding\n"; | 199 | "Partition %u is already defined, delete it before re-adding\n"; |
197 | /* #endif */ | 200 | #endif |
198 | 201 | ||
199 | 202 | ||
200 | struct partition { | 203 | struct partition { |