diff options
Diffstat (limited to 'networking/tcpudp.c')
-rw-r--r-- | networking/tcpudp.c | 10 |
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) | |||
276 | setsockopt_reuseaddr(sock); | 276 | setsockopt_reuseaddr(sock); |
277 | sa_len = lsa->len; /* I presume sockaddr len stays the same */ | 277 | sa_len = lsa->len; /* I presume sockaddr len stays the same */ |
278 | xbind(sock, &lsa->u.sa, sa_len); | 278 | xbind(sock, &lsa->u.sa, sa_len); |
279 | if (tcp) | 279 | if (tcp) { |
280 | xlisten(sock, backlog); | 280 | xlisten(sock, backlog); |
281 | else /* udp: needed for recv_from_to to work: */ | 281 | close_on_exec_on(sock); |
282 | } else { /* udp: needed for recv_from_to to work: */ | ||
282 | socket_want_pktinfo(sock); | 283 | socket_want_pktinfo(sock); |
284 | } | ||
283 | /* ndelay_off(sock); - it is the default I think? */ | 285 | /* ndelay_off(sock); - it is the default I think? */ |
284 | 286 | ||
285 | #ifndef SSLSVD | 287 | #ifndef SSLSVD |
@@ -410,10 +412,6 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) | |||
410 | 412 | ||
411 | /* Child: prepare env, log, and exec prog */ | 413 | /* Child: prepare env, log, and exec prog */ |
412 | 414 | ||
413 | /* Closing tcp listening socket */ | ||
414 | if (tcp) | ||
415 | close(sock); | ||
416 | |||
417 | { /* vfork alert! every xmalloc in this block should be freed! */ | 415 | { /* vfork alert! every xmalloc in this block should be freed! */ |
418 | char *local_hostname = local_hostname; /* for compiler */ | 416 | char *local_hostname = local_hostname; /* for compiler */ |
419 | char *local_addr = NULL; | 417 | char *local_addr = NULL; |