aboutsummaryrefslogtreecommitdiff
path: root/networking/tcpudp.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-06-13 22:49:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-06-13 22:49:08 +0200
commit16635cc2e052897ce7c2d4989acd0b706c3ac3dd (patch)
tree35af25c96f7f6e6340c043a91b10f46593c6afce /networking/tcpudp.c
parenta3dcee3e8a2d41e90cc235fd407dff9fe99d8604 (diff)
downloadbusybox-16635cc2e052897ce7c2d4989acd0b706c3ac3dd.tar.gz
test, tcpsvd, tcpsvd: shrink
function old new delta nexpr 825 826 +1 tcpudpsvd_main 1830 1822 -8 test_main 257 247 -10 binop 584 525 -59 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 1/-77) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tcpudp.c')
-rw-r--r--networking/tcpudp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index 55a3e0899..a5be192fb 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -276,10 +276,12 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
setsockopt_reuseaddr(sock);
sa_len = lsa->len; /* I presume sockaddr len stays the same */
xbind(sock, &lsa->u.sa, sa_len);
- if (tcp)
+ if (tcp) {
xlisten(sock, backlog);
- else /* udp: needed for recv_from_to to work: */
+ close_on_exec_on(sock);
+ } else { /* udp: needed for recv_from_to to work: */
socket_want_pktinfo(sock);
+ }
/* ndelay_off(sock); - it is the default I think? */
#ifndef SSLSVD
@@ -410,10 +412,6 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
/* Child: prepare env, log, and exec prog */
- /* Closing tcp listening socket */
- if (tcp)
- close(sock);
-
{ /* vfork alert! every xmalloc in this block should be freed! */
char *local_hostname = local_hostname; /* for compiler */
char *local_addr = NULL;