Contents of /trunk/ppp/patches/ppp-2.4.4-wait-children.patch
Parent Directory | Revision Log
Revision 797 -
(show annotations)
(download)
Mon May 11 09:46:04 2009 UTC (15 years, 4 months ago) by niro
File size: 2034 byte(s)
Mon May 11 09:46:04 2009 UTC (15 years, 4 months ago) by niro
File size: 2034 byte(s)
-added patches from gentoo
1 | diff -Nru ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c |
2 | --- ppp-2.4.4.orig/pppd/main.c 2006-11-03 11:28:38.000000000 +0200 |
3 | +++ ppp-2.4.4/pppd/main.c 2006-11-03 11:30:49.080255750 +0200 |
4 | @@ -248,6 +248,7 @@ |
5 | static void forget_child __P((int pid, int status)); |
6 | static int reap_kids __P((void)); |
7 | static void childwait_end __P((void *)); |
8 | +static void wait_children __P((void)); |
9 | |
10 | #ifdef USE_TDB |
11 | static void update_db_entry __P((void)); |
12 | @@ -579,25 +580,11 @@ |
13 | if (!persist) |
14 | break; |
15 | } |
16 | + |
17 | + wait_children(); |
18 | } |
19 | |
20 | - /* Wait for scripts to finish */ |
21 | - reap_kids(); |
22 | - if (n_children > 0) { |
23 | - if (child_wait > 0) |
24 | - TIMEOUT(childwait_end, NULL, child_wait); |
25 | - if (debug) { |
26 | - struct subprocess *chp; |
27 | - dbglog("Waiting for %d child processes...", n_children); |
28 | - for (chp = children; chp != NULL; chp = chp->next) |
29 | - dbglog(" script %s, pid %d", chp->prog, chp->pid); |
30 | - } |
31 | - while (n_children > 0 && !childwait_done) { |
32 | - handle_events(); |
33 | - if (kill_link && !childwait_done) |
34 | - childwait_end(NULL); |
35 | - } |
36 | - } |
37 | + wait_children(); |
38 | |
39 | die(status); |
40 | return 0; |
41 | @@ -1776,6 +1763,36 @@ |
42 | } |
43 | |
44 | /* |
45 | + * wait_children - wait for scripts to finish. |
46 | + * if child_wait is 0, wait indefinitely. |
47 | + * else, kill'em all at the end of timeout |
48 | + */ |
49 | +static void |
50 | +wait_children() |
51 | +{ |
52 | + /* Wait for scripts to finish */ |
53 | + reap_kids(); |
54 | + if (n_children > 0) { |
55 | + childwait_done = 0; |
56 | + if (child_wait > 0) |
57 | + TIMEOUT(childwait_end, NULL, child_wait); |
58 | + if (debug) { |
59 | + struct subprocess *chp; |
60 | + dbglog("Waiting for %d child processes...", n_children); |
61 | + for (chp = children; chp != NULL; chp = chp->next) |
62 | + dbglog(" script %s, pid %d", chp->prog, chp->pid); |
63 | + } |
64 | + while (n_children > 0 && !childwait_done) { |
65 | + handle_events(); |
66 | + if (asked_to_quit && !childwait_done) |
67 | + childwait_end(NULL); |
68 | + } |
69 | + if (child_wait > 0) |
70 | + UNTIMEOUT(childwait_end, NULL); |
71 | + } |
72 | +} |
73 | + |
74 | +/* |
75 | * childwait_end - we got fed up waiting for the child processes to |
76 | * exit, send them all a SIGTERM. |
77 | */ |