]> git.pld-linux.org Git - packages/busybox.git/blob - busybox-1.19.2-inetd.patch
- rel 2; fix build with external printf (like on mksh)
[packages/busybox.git] / busybox-1.19.2-inetd.patch
1 --- busybox-1.19.2/networking/inetd.c
2 +++ busybox-1.19.2-inetd/networking/inetd.c
3 @@ -1278,6 +1278,7 @@ int inetd_main(int argc UNUSED_PARAM, ch
4                                                         sep->se_count = 0;
5                                                         rearm_alarm(); /* will revive it in RETRYTIME sec */
6                                                         restore_sigmask(&omask);
7 +                                                       maybe_close(new_udp_fd);
8                                                         maybe_close(accepted_fd);
9                                                         continue; /* -> check next fd in fd set */
10                                                 }
11 @@ -1298,17 +1299,18 @@ int inetd_main(int argc UNUSED_PARAM, ch
12                                         bb_perror_msg("vfork"+1);
13                                         sleep(1);
14                                         restore_sigmask(&omask);
15 +                                       maybe_close(new_udp_fd);
16                                         maybe_close(accepted_fd);
17                                         continue; /* -> check next fd in fd set */
18                                 }
19                                 if (pid == 0)
20                                         pid--; /* -1: "we did fork and we are child" */
21                         }
22 -                       /* if pid == 0 here, we never forked */
23 +                       /* if pid == 0 here, we didn't fork */
24  
25                         if (pid > 0) { /* parent */
26                                 if (sep->se_wait) {
27 -                                       /* tcp wait: we passed listening socket to child,
28 +                                       /* wait: we passed socket to child,
29                                          * will wait for child to terminate */
30                                         sep->se_wait = pid;
31                                         remove_fd_from_set(sep->se_fd);
32 @@ -1345,9 +1347,13 @@ int inetd_main(int argc UNUSED_PARAM, ch
33                         setsid();
34                         /* "nowait" udp */
35                         if (new_udp_fd >= 0) {
36 -                               len_and_sockaddr *lsa = xzalloc_lsa(sep->se_family);
37 +                               len_and_sockaddr *lsa;
38 +                               int r;
39 +
40 +                               close(new_udp_fd);
41 +                               lsa = xzalloc_lsa(sep->se_family);
42                                 /* peek at the packet and remember peer addr */
43 -                               int r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT,
44 +                               r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT,
45                                         &lsa->u.sa, &lsa->len);
46                                 if (r < 0)
47                                         goto do_exit1;
This page took 0.494144 seconds and 3 git commands to generate.