summaryrefslogtreecommitdiff
path: root/user/ppp/08_all_wait-children.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-05-10 00:24:51 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-05-10 00:24:51 +0000
commitd950a50ac6855d2a49328247ad0e6e9933547d33 (patch)
tree13e27624a878ce2688d0172afc1ee18171a92b8c /user/ppp/08_all_wait-children.patch
parent70e535f4073f219b6905fe82326ac1563d5c09ad (diff)
downloadpackages-d950a50ac6855d2a49328247ad0e6e9933547d33.tar.gz
packages-d950a50ac6855d2a49328247ad0e6e9933547d33.tar.bz2
packages-d950a50ac6855d2a49328247ad0e6e9933547d33.tar.xz
packages-d950a50ac6855d2a49328247ad0e6e9933547d33.zip
user/ppp: new package
Diffstat (limited to 'user/ppp/08_all_wait-children.patch')
-rw-r--r--user/ppp/08_all_wait-children.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/user/ppp/08_all_wait-children.patch b/user/ppp/08_all_wait-children.patch
new file mode 100644
index 000000000..708cf04d6
--- /dev/null
+++ b/user/ppp/08_all_wait-children.patch
@@ -0,0 +1,76 @@
+--- ppp-2.4.5/pppd/main.c
++++ ppp-2.4.5/pppd/main.c
+@@ -249,6 +249,7 @@
+ static void forget_child __P((int pid, int status));
+ static int reap_kids __P((void));
+ static void childwait_end __P((void *));
++static void wait_children __P((void));
+
+ #ifdef USE_TDB
+ static void update_db_entry __P((void));
+@@ -580,25 +581,11 @@
+ if (!persist)
+ break;
+ }
++
++ wait_children();
+ }
+
+- /* Wait for scripts to finish */
+- reap_kids();
+- if (n_children > 0) {
+- if (child_wait > 0)
+- TIMEOUT(childwait_end, NULL, child_wait);
+- if (debug) {
+- struct subprocess *chp;
+- dbglog("Waiting for %d child processes...", n_children);
+- for (chp = children; chp != NULL; chp = chp->next)
+- dbglog(" script %s, pid %d", chp->prog, chp->pid);
+- }
+- while (n_children > 0 && !childwait_done) {
+- handle_events();
+- if (kill_link && !childwait_done)
+- childwait_end(NULL);
+- }
+- }
++ wait_children();
+
+ die(status);
+ return 0;
+@@ -1794,6 +1781,36 @@
+ }
+
+ /*
++ * wait_children - wait for scripts to finish.
++ * if child_wait is 0, wait indefinitely.
++ * else, kill'em all at the end of timeout
++ */
++static void
++wait_children()
++{
++ /* Wait for scripts to finish */
++ reap_kids();
++ if (n_children > 0) {
++ childwait_done = 0;
++ if (child_wait > 0)
++ TIMEOUT(childwait_end, NULL, child_wait);
++ if (debug) {
++ struct subprocess *chp;
++ dbglog("Waiting for %d child processes...", n_children);
++ for (chp = children; chp != NULL; chp = chp->next)
++ dbglog(" script %s, pid %d", chp->prog, chp->pid);
++ }
++ while (n_children > 0 && !childwait_done) {
++ handle_events();
++ if (asked_to_quit && !childwait_done)
++ childwait_end(NULL);
++ }
++ if (child_wait > 0)
++ UNTIMEOUT(childwait_end, NULL);
++ }
++}
++
++/*
+ * childwait_end - we got fed up waiting for the child processes to
+ * exit, send them all a SIGTERM.
+ */