diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-17 08:29:48 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-17 08:29:48 +0000 |
commit | 856be770a66a4d928f13c9d2f401dc1092e5270e (patch) | |
tree | 62c6391260ae26ec9a383e72265a4ab3f6894373 | |
parent | 7f175ccbc38c0de2423a9554f8ee1663431845d9 (diff) | |
download | busybox-w32-856be770a66a4d928f13c9d2f401dc1092e5270e.tar.gz busybox-w32-856be770a66a4d928f13c9d2f401dc1092e5270e.tar.bz2 busybox-w32-856be770a66a4d928f13c9d2f401dc1092e5270e.zip |
assorted fixes for breakage found by randomconfig
-rw-r--r-- | applets/applets.c | 3 | ||||
-rw-r--r-- | archival/libunarchive/Kbuild | 2 | ||||
-rw-r--r-- | editors/vi.c | 15 | ||||
-rw-r--r-- | miscutils/devfsd.c | 9 | ||||
-rw-r--r-- | networking/ifupdown.c | 2 | ||||
-rw-r--r-- | networking/libiproute/Kbuild | 4 | ||||
-rw-r--r-- | procps/top.c | 56 | ||||
-rw-r--r-- | util-linux/more.c | 2 |
8 files changed, 54 insertions, 39 deletions
diff --git a/applets/applets.c b/applets/applets.c index 6ff4301e4..6de6db3cd 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -48,6 +48,9 @@ static const char usage_messages[] ALIGN1 = "" | |||
48 | #include "applets.h" | 48 | #include "applets.h" |
49 | /* The -1 arises because of the {0,NULL,0,-1} entry. */ | 49 | /* The -1 arises because of the {0,NULL,0,-1} entry. */ |
50 | 50 | ||
51 | #if ENABLE_FEATURE_SH_STANDALONE | ||
52 | const unsigned short NUM_APPLETS = ARRAY_SIZE(applets); | ||
53 | #endif | ||
51 | const struct bb_applet *current_applet; | 54 | const struct bb_applet *current_applet; |
52 | const char *applet_name ATTRIBUTE_EXTERNALLY_VISIBLE; | 55 | const char *applet_name ATTRIBUTE_EXTERNALLY_VISIBLE; |
53 | #if !BB_MMU | 56 | #if !BB_MMU |
diff --git a/archival/libunarchive/Kbuild b/archival/libunarchive/Kbuild index 412a2332d..3c29d541a 100644 --- a/archival/libunarchive/Kbuild +++ b/archival/libunarchive/Kbuild | |||
@@ -58,6 +58,7 @@ lib-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) | |||
58 | lib-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o | 58 | lib-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o |
59 | lib-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o | 59 | lib-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o |
60 | lib-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o | 60 | lib-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o |
61 | lib-$(CONFIG_FEATURE_RPM_BZ2) += decompress_bunzip2.o | ||
61 | lib-$(CONFIG_TAR) += get_header_tar.o | 62 | lib-$(CONFIG_TAR) += get_header_tar.o |
62 | lib-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o | 63 | lib-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o |
63 | lib-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | 64 | lib-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o |
@@ -66,3 +67,4 @@ lib-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o | |||
66 | lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o | 67 | lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o |
67 | lib-$(CONFIG_UNZIP) += $(GUNZIP_FILES) | 68 | lib-$(CONFIG_UNZIP) += $(GUNZIP_FILES) |
68 | lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o | 69 | lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o |
70 | |||
diff --git a/editors/vi.c b/editors/vi.c index 461cf9889..afbddc251 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2420,14 +2420,17 @@ static int file_insert(const char * fn, char *p | |||
2420 | file_modified++; | 2420 | file_modified++; |
2421 | close(fd); | 2421 | close(fd); |
2422 | fi0: | 2422 | fi0: |
2423 | if (ENABLE_FEATURE_VI_READONLY && update_ro_status | 2423 | #if ENABLE_FEATURE_VI_READONLY |
2424 | && ((access(fn, W_OK) < 0) || | 2424 | if (update_ro_status |
2425 | /* root will always have access() | 2425 | && ((access(fn, W_OK) < 0) || |
2426 | * so we check fileperms too */ | 2426 | /* root will always have access() |
2427 | !(statbuf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))) | 2427 | * so we check fileperms too */ |
2428 | { | 2428 | !(statbuf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) |
2429 | ) | ||
2430 | ) { | ||
2429 | SET_READONLY_FILE(readonly_mode); | 2431 | SET_READONLY_FILE(readonly_mode); |
2430 | } | 2432 | } |
2433 | #endif | ||
2431 | return cnt; | 2434 | return cnt; |
2432 | } | 2435 | } |
2433 | 2436 | ||
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 6b31f368a..bfa5c1727 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -631,7 +631,8 @@ static void process_config_line(const char *line, unsigned long *event_mask) | |||
631 | last_config->next = new; | 631 | last_config->next = new; |
632 | last_config = new; | 632 | last_config = new; |
633 | return; | 633 | return; |
634 | process_config_line_err: | 634 | |
635 | process_config_line_err: | ||
635 | msg_logger_and_die(LOG_ERR, bb_msg_bad_config, msg , line); | 636 | msg_logger_and_die(LOG_ERR, bb_msg_bad_config, msg , line); |
636 | } /* End Function process_config_line */ | 637 | } /* End Function process_config_line */ |
637 | 638 | ||
@@ -644,11 +645,9 @@ static int do_servicing(int fd, unsigned long event_mask) | |||
644 | { | 645 | { |
645 | ssize_t bytes; | 646 | ssize_t bytes; |
646 | struct devfsd_notify_struct info; | 647 | struct devfsd_notify_struct info; |
647 | unsigned long tmp_event_mask; | ||
648 | 648 | ||
649 | /* Tell devfs what events we care about */ | 649 | /* (void*) cast is only in order to match prototype */ |
650 | tmp_event_mask = event_mask; | 650 | xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, (void*)event_mask); |
651 | xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, tmp_event_mask); | ||
652 | while (!caught_signal) { | 651 | while (!caught_signal) { |
653 | errno = 0; | 652 | errno = 0; |
654 | bytes = read(fd,(char *) &info, sizeof info); | 653 | bytes = read(fd,(char *) &info, sizeof info); |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 040bbe389..e1c1e652b 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -484,12 +484,12 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { | |||
484 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | 484 | static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) |
485 | { | 485 | { |
486 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | 486 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP |
487 | int i; | ||
487 | #if ENABLE_FEATURE_IFUPDOWN_IP | 488 | #if ENABLE_FEATURE_IFUPDOWN_IP |
488 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ | 489 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ |
489 | if (!execute("ip link set %iface% up", ifd, exec)) | 490 | if (!execute("ip link set %iface% up", ifd, exec)) |
490 | return 0; | 491 | return 0; |
491 | #endif | 492 | #endif |
492 | int i; | ||
493 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { | 493 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { |
494 | if (exists_execable(ext_dhcp_clients[i].name)) | 494 | if (exists_execable(ext_dhcp_clients[i].name)) |
495 | return execute(ext_dhcp_clients[i].startcmd, ifd, exec); | 495 | return execute(ext_dhcp_clients[i].startcmd, ifd, exec); |
diff --git a/networking/libiproute/Kbuild b/networking/libiproute/Kbuild index 95d37e8e7..9e9e760ad 100644 --- a/networking/libiproute/Kbuild +++ b/networking/libiproute/Kbuild | |||
@@ -6,6 +6,10 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | lib-y:= | 8 | lib-y:= |
9 | |||
10 | lib-$(CONFIG_SLATTACH) += \ | ||
11 | utils.o | ||
12 | |||
9 | lib-$(CONFIG_IP) += \ | 13 | lib-$(CONFIG_IP) += \ |
10 | ip_parse_common_args.o \ | 14 | ip_parse_common_args.o \ |
11 | libnetlink.o \ | 15 | libnetlink.o \ |
diff --git a/procps/top.c b/procps/top.c index e9ccac0cd..85699b027 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -219,7 +219,9 @@ static unsigned long display_generic(int scr_width) | |||
219 | char buf[80]; | 219 | char buf[80]; |
220 | char scrbuf[80]; | 220 | char scrbuf[80]; |
221 | unsigned long total, used, mfree, shared, buffers, cached; | 221 | unsigned long total, used, mfree, shared, buffers, cached; |
222 | #if ENABLE_FEATURE_TOP_DECIMALS || ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS | ||
222 | unsigned total_diff; | 223 | unsigned total_diff; |
224 | #endif | ||
223 | 225 | ||
224 | #if ENABLE_FEATURE_TOP_DECIMALS | 226 | #if ENABLE_FEATURE_TOP_DECIMALS |
225 | /* formats 7 char string (8 with terminating NUL) */ | 227 | /* formats 7 char string (8 with terminating NUL) */ |
@@ -305,12 +307,12 @@ static unsigned long display_generic(int scr_width) | |||
305 | /* clear screen & go to top */ | 307 | /* clear screen & go to top */ |
306 | printf(OPT_BATCH_MODE ? "%s\n" : "\e[H\e[J%s\n", scrbuf); | 308 | printf(OPT_BATCH_MODE ? "%s\n" : "\e[H\e[J%s\n", scrbuf); |
307 | 309 | ||
308 | if (ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS) { | 310 | #if ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS |
309 | /* | 311 | /* |
310 | * xxx% = (jif.xxx - prev_jif.xxx) / (jif.total - prev_jif.total) * 100% | 312 | * xxx% = (jif.xxx - prev_jif.xxx) / (jif.total - prev_jif.total) * 100% |
311 | */ | 313 | */ |
312 | /* using (unsigned) casts to make operations cheaper */ | 314 | /* using (unsigned) casts to make operations cheaper */ |
313 | total_diff = ((unsigned)(jif.total - prev_jif.total) ? : 1); | 315 | total_diff = ((unsigned)(jif.total - prev_jif.total) ? : 1); |
314 | #if ENABLE_FEATURE_TOP_DECIMALS | 316 | #if ENABLE_FEATURE_TOP_DECIMALS |
315 | /* Generated code is approx +0.3k */ | 317 | /* Generated code is approx +0.3k */ |
316 | #define CALC_STAT(xxx) char xxx[8] | 318 | #define CALC_STAT(xxx) char xxx[8] |
@@ -321,30 +323,30 @@ static unsigned long display_generic(int scr_width) | |||
321 | #define SHOW_STAT(xxx) xxx | 323 | #define SHOW_STAT(xxx) xxx |
322 | #define FMT "%4u%% " | 324 | #define FMT "%4u%% " |
323 | #endif | 325 | #endif |
324 | { /* need block: CALC_STAT are declarations */ | 326 | { /* need block: CALC_STAT are declarations */ |
325 | CALC_STAT(usr); | 327 | CALC_STAT(usr); |
326 | CALC_STAT(sys); | 328 | CALC_STAT(sys); |
327 | CALC_STAT(nic); | 329 | CALC_STAT(nic); |
328 | CALC_STAT(idle); | 330 | CALC_STAT(idle); |
329 | CALC_STAT(iowait); | 331 | CALC_STAT(iowait); |
330 | CALC_STAT(irq); | 332 | CALC_STAT(irq); |
331 | CALC_STAT(softirq); | 333 | CALC_STAT(softirq); |
332 | //CALC_STAT(steal); | 334 | //CALC_STAT(steal); |
333 | 335 | ||
334 | snprintf(scrbuf, scr_width, | 336 | snprintf(scrbuf, scr_width, |
335 | /* Barely fits in 79 chars when in "decimals" mode. */ | 337 | /* Barely fits in 79 chars when in "decimals" mode. */ |
336 | "CPU:"FMT"usr"FMT"sys"FMT"nice"FMT"idle"FMT"io"FMT"irq"FMT"softirq", | 338 | "CPU:"FMT"usr"FMT"sys"FMT"nice"FMT"idle"FMT"io"FMT"irq"FMT"softirq", |
337 | SHOW_STAT(usr), SHOW_STAT(sys), SHOW_STAT(nic), SHOW_STAT(idle), | 339 | SHOW_STAT(usr), SHOW_STAT(sys), SHOW_STAT(nic), SHOW_STAT(idle), |
338 | SHOW_STAT(iowait), SHOW_STAT(irq), SHOW_STAT(softirq) | 340 | SHOW_STAT(iowait), SHOW_STAT(irq), SHOW_STAT(softirq) |
339 | //, SHOW_STAT(steal) - what is this 'steal' thing? | 341 | //, SHOW_STAT(steal) - what is this 'steal' thing? |
340 | // I doubt anyone wants to know it | 342 | // I doubt anyone wants to know it |
341 | ); | 343 | ); |
342 | } | 344 | } |
343 | puts(scrbuf); | 345 | puts(scrbuf); |
344 | #undef SHOW_STAT | 346 | #undef SHOW_STAT |
345 | #undef CALC_STAT | 347 | #undef CALC_STAT |
346 | #undef FMT | 348 | #undef FMT |
347 | } | 349 | #endif |
348 | 350 | ||
349 | /* read load average as a string */ | 351 | /* read load average as a string */ |
350 | buf[0] = '\0'; | 352 | buf[0] = '\0'; |
diff --git a/util-linux/more.c b/util-linux/more.c index 92ebdfea9..dc5b4c99e 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
@@ -154,8 +154,10 @@ int more_main(int argc, char **argv) | |||
154 | 154 | ||
155 | /* The user may have resized the terminal. | 155 | /* The user may have resized the terminal. |
156 | * Re-read the dimensions. */ | 156 | * Re-read the dimensions. */ |
157 | #if ENABLE_FEATURE_USE_TERMIOS | ||
157 | get_terminal_width_height(cin_fileno, &terminal_width, &terminal_height); | 158 | get_terminal_width_height(cin_fileno, &terminal_width, &terminal_height); |
158 | terminal_height -= 1; | 159 | terminal_height -= 1; |
160 | #endif | ||
159 | } | 161 | } |
160 | 162 | ||
161 | /* Crudely convert tabs into spaces, which are | 163 | /* Crudely convert tabs into spaces, which are |