diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-03 21:31:16 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-03 21:31:16 +0200 |
commit | d4e4fdb5ce5ccc067b3d35d877f7a7d978869517 (patch) | |
tree | bac3e4a55fa72db0c67d377b90869b4d63e8c3c9 /networking | |
parent | 2e989ef232e35750df573898077dd356003705b2 (diff) | |
download | busybox-w32-d4e4fdb5ce5ccc067b3d35d877f7a7d978869517.tar.gz busybox-w32-d4e4fdb5ce5ccc067b3d35d877f7a7d978869517.tar.bz2 busybox-w32-d4e4fdb5ce5ccc067b3d35d877f7a7d978869517.zip |
fixes for bugs found by make_single_applets.sh
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/inetd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 01e659f13..39169a935 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1513,8 +1513,11 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1513 | } /* for (;;) */ | 1513 | } /* for (;;) */ |
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | #if !BB_MMU | 1516 | #if ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_ECHO \ |
1517 | || ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD | ||
1518 | # if !BB_MMU | ||
1517 | static const char *const cat_args[] = { "cat", NULL }; | 1519 | static const char *const cat_args[] = { "cat", NULL }; |
1520 | # endif | ||
1518 | #endif | 1521 | #endif |
1519 | 1522 | ||
1520 | /* | 1523 | /* |
@@ -1525,14 +1528,14 @@ static const char *const cat_args[] = { "cat", NULL }; | |||
1525 | /* ARGSUSED */ | 1528 | /* ARGSUSED */ |
1526 | static void FAST_FUNC echo_stream(int s, servtab_t *sep UNUSED_PARAM) | 1529 | static void FAST_FUNC echo_stream(int s, servtab_t *sep UNUSED_PARAM) |
1527 | { | 1530 | { |
1528 | #if BB_MMU | 1531 | # if BB_MMU |
1529 | while (1) { | 1532 | while (1) { |
1530 | ssize_t sz = safe_read(s, line, LINE_SIZE); | 1533 | ssize_t sz = safe_read(s, line, LINE_SIZE); |
1531 | if (sz <= 0) | 1534 | if (sz <= 0) |
1532 | break; | 1535 | break; |
1533 | xwrite(s, line, sz); | 1536 | xwrite(s, line, sz); |
1534 | } | 1537 | } |
1535 | #else | 1538 | # else |
1536 | /* We are after vfork here! */ | 1539 | /* We are after vfork here! */ |
1537 | /* move network socket to stdin/stdout */ | 1540 | /* move network socket to stdin/stdout */ |
1538 | xmove_fd(s, STDIN_FILENO); | 1541 | xmove_fd(s, STDIN_FILENO); |
@@ -1542,7 +1545,7 @@ static void FAST_FUNC echo_stream(int s, servtab_t *sep UNUSED_PARAM) | |||
1542 | xopen(bb_dev_null, O_WRONLY); | 1545 | xopen(bb_dev_null, O_WRONLY); |
1543 | BB_EXECVP("cat", (char**)cat_args); | 1546 | BB_EXECVP("cat", (char**)cat_args); |
1544 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ | 1547 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ |
1545 | #endif | 1548 | # endif |
1546 | } | 1549 | } |
1547 | static void FAST_FUNC echo_dg(int s, servtab_t *sep) | 1550 | static void FAST_FUNC echo_dg(int s, servtab_t *sep) |
1548 | { | 1551 | { |
@@ -1566,10 +1569,10 @@ static void FAST_FUNC echo_dg(int s, servtab_t *sep) | |||
1566 | /* ARGSUSED */ | 1569 | /* ARGSUSED */ |
1567 | static void FAST_FUNC discard_stream(int s, servtab_t *sep UNUSED_PARAM) | 1570 | static void FAST_FUNC discard_stream(int s, servtab_t *sep UNUSED_PARAM) |
1568 | { | 1571 | { |
1569 | #if BB_MMU | 1572 | # if BB_MMU |
1570 | while (safe_read(s, line, LINE_SIZE) > 0) | 1573 | while (safe_read(s, line, LINE_SIZE) > 0) |
1571 | continue; | 1574 | continue; |
1572 | #else | 1575 | # else |
1573 | /* We are after vfork here! */ | 1576 | /* We are after vfork here! */ |
1574 | /* move network socket to stdin */ | 1577 | /* move network socket to stdin */ |
1575 | xmove_fd(s, STDIN_FILENO); | 1578 | xmove_fd(s, STDIN_FILENO); |
@@ -1580,7 +1583,7 @@ static void FAST_FUNC discard_stream(int s, servtab_t *sep UNUSED_PARAM) | |||
1580 | xdup2(STDOUT_FILENO, STDERR_FILENO); | 1583 | xdup2(STDOUT_FILENO, STDERR_FILENO); |
1581 | BB_EXECVP("cat", (char**)cat_args); | 1584 | BB_EXECVP("cat", (char**)cat_args); |
1582 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ | 1585 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ |
1583 | #endif | 1586 | # endif |
1584 | } | 1587 | } |
1585 | /* ARGSUSED */ | 1588 | /* ARGSUSED */ |
1586 | static void FAST_FUNC discard_dg(int s, servtab_t *sep UNUSED_PARAM) | 1589 | static void FAST_FUNC discard_dg(int s, servtab_t *sep UNUSED_PARAM) |