diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-16 22:53:05 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-16 22:53:05 +0000 |
commit | 557613656317ccf401669dcc6681155bf2930c9f (patch) | |
tree | 4c1b64b064a304cf4aca3bc9696c6a962d677409 | |
parent | 23c8128916d9a40b473557a11d431549a94604f1 (diff) | |
download | busybox-w32-557613656317ccf401669dcc6681155bf2930c9f.tar.gz busybox-w32-557613656317ccf401669dcc6681155bf2930c9f.tar.bz2 busybox-w32-557613656317ccf401669dcc6681155bf2930c9f.zip |
fixes revealed by randomconfig run
-rw-r--r-- | coreutils/stat.c | 2 | ||||
-rw-r--r-- | networking/telnetd.c | 18 | ||||
-rw-r--r-- | procps/top.c | 4 |
3 files changed, 14 insertions, 10 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c index a5a30546d..5996268ef 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -119,6 +119,7 @@ static const char *human_fstype(uint32_t f_type) | |||
119 | return humantypes[i].fs; | 119 | return humantypes[i].fs; |
120 | } | 120 | } |
121 | 121 | ||
122 | #if ENABLE_FEATURE_STAT_FORMAT | ||
122 | static void strcatc(char *str, char c) | 123 | static void strcatc(char *str, char c) |
123 | { | 124 | { |
124 | int len = strlen(str); | 125 | int len = strlen(str); |
@@ -132,7 +133,6 @@ static void printfs(char *pformat, const char *msg) | |||
132 | printf(pformat, msg); | 133 | printf(pformat, msg); |
133 | } | 134 | } |
134 | 135 | ||
135 | #if ENABLE_FEATURE_STAT_FORMAT | ||
136 | /* print statfs info */ | 136 | /* print statfs info */ |
137 | static void print_statfs(char *pformat, const char m, | 137 | static void print_statfs(char *pformat, const char m, |
138 | const char *const filename, const void *data | 138 | const char *const filename, const void *data |
diff --git a/networking/telnetd.c b/networking/telnetd.c index 8cadc6344..f1927e069 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
@@ -492,7 +492,11 @@ int telnetd_main(int argc, char **argv) | |||
492 | while (ts) { | 492 | while (ts) { |
493 | struct tsession *next = ts->next; /* in case we free ts. */ | 493 | struct tsession *next = ts->next; /* in case we free ts. */ |
494 | if (ts->shell_pid == -1) { | 494 | if (ts->shell_pid == -1) { |
495 | #if !ENABLE_FEATURE_TELNETD_STANDALONE | ||
496 | return 0; | ||
497 | #else | ||
495 | free_session(ts); | 498 | free_session(ts); |
499 | #endif | ||
496 | } else { | 500 | } else { |
497 | if (ts->size1 > 0) /* can write to pty */ | 501 | if (ts->size1 > 0) /* can write to pty */ |
498 | FD_SET(ts->ptyfd, &wrfdset); | 502 | FD_SET(ts->ptyfd, &wrfdset); |
@@ -552,8 +556,6 @@ int telnetd_main(int argc, char **argv) | |||
552 | if (count < 0) { | 556 | if (count < 0) { |
553 | if (errno == EAGAIN) | 557 | if (errno == EAGAIN) |
554 | goto skip1; | 558 | goto skip1; |
555 | if (IS_INETD) | ||
556 | return 0; | ||
557 | goto kill_session; | 559 | goto kill_session; |
558 | } | 560 | } |
559 | ts->size1 -= count; | 561 | ts->size1 -= count; |
@@ -569,8 +571,6 @@ int telnetd_main(int argc, char **argv) | |||
569 | if (count < 0) { | 571 | if (count < 0) { |
570 | if (errno == EAGAIN) | 572 | if (errno == EAGAIN) |
571 | goto skip2; | 573 | goto skip2; |
572 | if (IS_INETD) | ||
573 | return 0; | ||
574 | goto kill_session; | 574 | goto kill_session; |
575 | } | 575 | } |
576 | ts->size2 -= count; | 576 | ts->size2 -= count; |
@@ -601,8 +601,6 @@ int telnetd_main(int argc, char **argv) | |||
601 | if (count <= 0) { | 601 | if (count <= 0) { |
602 | if (count < 0 && errno == EAGAIN) | 602 | if (count < 0 && errno == EAGAIN) |
603 | goto skip3; | 603 | goto skip3; |
604 | if (IS_INETD) | ||
605 | return 0; | ||
606 | goto kill_session; | 604 | goto kill_session; |
607 | } | 605 | } |
608 | /* Ignore trailing NUL if it is there */ | 606 | /* Ignore trailing NUL if it is there */ |
@@ -622,8 +620,6 @@ int telnetd_main(int argc, char **argv) | |||
622 | if (count <= 0) { | 620 | if (count <= 0) { |
623 | if (count < 0 && errno == EAGAIN) | 621 | if (count < 0 && errno == EAGAIN) |
624 | goto skip4; | 622 | goto skip4; |
625 | if (IS_INETD) | ||
626 | return 0; | ||
627 | goto kill_session; | 623 | goto kill_session; |
628 | } | 624 | } |
629 | ts->size2 += count; | 625 | ts->size2 += count; |
@@ -635,8 +631,14 @@ int telnetd_main(int argc, char **argv) | |||
635 | ts = next; | 631 | ts = next; |
636 | continue; | 632 | continue; |
637 | kill_session: | 633 | kill_session: |
634 | #if !ENABLE_FEATURE_TELNETD_STANDALONE | ||
635 | return 0; | ||
636 | #else | ||
637 | if (IS_INETD) | ||
638 | return 0; | ||
638 | free_session(ts); | 639 | free_session(ts); |
639 | ts = next; | 640 | ts = next; |
641 | #endif | ||
640 | } | 642 | } |
641 | 643 | ||
642 | goto again; | 644 | goto again; |
diff --git a/procps/top.c b/procps/top.c index 7f1c83fc1..0da742f0b 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -82,10 +82,12 @@ struct globals { | |||
82 | /* int hist_iterations; */ | 82 | /* int hist_iterations; */ |
83 | unsigned total_pcpu; | 83 | unsigned total_pcpu; |
84 | /* unsigned long total_vsz; */ | 84 | /* unsigned long total_vsz; */ |
85 | char line_buf[80]; | ||
86 | #endif | 85 | #endif |
86 | char line_buf[80]; | ||
87 | }; | 87 | }; |
88 | |||
88 | enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) }; | 89 | enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) }; |
90 | |||
89 | #define G (*(struct globals*)&bb_common_bufsiz1) | 91 | #define G (*(struct globals*)&bb_common_bufsiz1) |
90 | #define INIT_G() \ | 92 | #define INIT_G() \ |
91 | do { \ | 93 | do { \ |