diff options
author | Denys Vlasenko | 2011-10-28 17:48:15 +0200 |
---|---|---|
committer | Denys Vlasenko | 2011-10-28 17:48:15 +0200 |
commit | 1e98f3741c5a844c1d3d7966f20cd09dded05d0d (patch) | |
tree | 6044a3e180389e63c55173f5018bf2ddaa195cd6 /networking/inetd.c | |
parent | ed058016bf8fc98271de2e58bfb650de9e9d304d (diff) | |
download | busybox-1_19_3.zip busybox-1_19_3.tar.gz |
Apply post-1.19.2 patches, bump version to 1.19.31_19_3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/inetd.c')
-rw-r--r-- | networking/inetd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 873fd95..05ad8c7 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -1278,6 +1278,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) sep->se_count = 0; rearm_alarm(); /* will revive it in RETRYTIME sec */ restore_sigmask(&omask); + maybe_close(new_udp_fd); maybe_close(accepted_fd); continue; /* -> check next fd in fd set */ } @@ -1298,17 +1299,18 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) bb_perror_msg("vfork"+1); sleep(1); restore_sigmask(&omask); + maybe_close(new_udp_fd); maybe_close(accepted_fd); continue; /* -> check next fd in fd set */ } if (pid == 0) pid--; /* -1: "we did fork and we are child" */ } - /* if pid == 0 here, we never forked */ + /* if pid == 0 here, we didn't fork */ if (pid > 0) { /* parent */ if (sep->se_wait) { - /* tcp wait: we passed listening socket to child, + /* wait: we passed socket to child, * will wait for child to terminate */ sep->se_wait = pid; remove_fd_from_set(sep->se_fd); @@ -1345,9 +1347,13 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) setsid(); /* "nowait" udp */ if (new_udp_fd >= 0) { - len_and_sockaddr *lsa = xzalloc_lsa(sep->se_family); + len_and_sockaddr *lsa; + int r; + + close(new_udp_fd); + lsa = xzalloc_lsa(sep->se_family); /* peek at the packet and remember peer addr */ - int r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT, + r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT, &lsa->u.sa, &lsa->len); if (r < 0) goto do_exit1; |