From 557613656317ccf401669dcc6681155bf2930c9f Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 16 Oct 2007 22:53:05 +0000 Subject: [PATCH] fixes revealed by randomconfig run --- coreutils/stat.c | 2 +- networking/telnetd.c | 18 ++++++++++-------- 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) return humantypes[i].fs; } +#if ENABLE_FEATURE_STAT_FORMAT static void strcatc(char *str, char c) { int len = strlen(str); @@ -132,7 +133,6 @@ static void printfs(char *pformat, const char *msg) printf(pformat, msg); } -#if ENABLE_FEATURE_STAT_FORMAT /* print statfs info */ static void print_statfs(char *pformat, const char m, 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) while (ts) { struct tsession *next = ts->next; /* in case we free ts. */ if (ts->shell_pid == -1) { +#if !ENABLE_FEATURE_TELNETD_STANDALONE + return 0; +#else free_session(ts); +#endif } else { if (ts->size1 > 0) /* can write to pty */ FD_SET(ts->ptyfd, &wrfdset); @@ -552,8 +556,6 @@ int telnetd_main(int argc, char **argv) if (count < 0) { if (errno == EAGAIN) goto skip1; - if (IS_INETD) - return 0; goto kill_session; } ts->size1 -= count; @@ -569,8 +571,6 @@ int telnetd_main(int argc, char **argv) if (count < 0) { if (errno == EAGAIN) goto skip2; - if (IS_INETD) - return 0; goto kill_session; } ts->size2 -= count; @@ -601,8 +601,6 @@ int telnetd_main(int argc, char **argv) if (count <= 0) { if (count < 0 && errno == EAGAIN) goto skip3; - if (IS_INETD) - return 0; goto kill_session; } /* Ignore trailing NUL if it is there */ @@ -622,8 +620,6 @@ int telnetd_main(int argc, char **argv) if (count <= 0) { if (count < 0 && errno == EAGAIN) goto skip4; - if (IS_INETD) - return 0; goto kill_session; } ts->size2 += count; @@ -635,8 +631,14 @@ int telnetd_main(int argc, char **argv) ts = next; continue; kill_session: +#if !ENABLE_FEATURE_TELNETD_STANDALONE + return 0; +#else + if (IS_INETD) + return 0; free_session(ts); ts = next; +#endif } 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 { /* int hist_iterations; */ unsigned total_pcpu; /* unsigned long total_vsz; */ - char line_buf[80]; #endif + char line_buf[80]; }; + enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) }; + #define G (*(struct globals*)&bb_common_bufsiz1) #define INIT_G() \ do { \ -- 2.25.1