Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 296267 | Differences between
and this patch

Collapse All | Expand All

(-)ppp-2.4.4.orig/pppd/main.c (-17 / +34 lines)
Lines 248-253 Link Here
248
static void forget_child __P((int pid, int status));
248
static void forget_child __P((int pid, int status));
249
static int reap_kids __P((void));
249
static int reap_kids __P((void));
250
static void childwait_end __P((void *));
250
static void childwait_end __P((void *));
251
static void wait_children __P((void));
251
252
252
#ifdef USE_TDB
253
#ifdef USE_TDB
253
static void update_db_entry __P((void));
254
static void update_db_entry __P((void));
Lines 579-603 Link Here
579
	    if (!persist)
580
	    if (!persist)
580
		break;
581
		break;
581
	}
582
	}
583
	
584
	wait_children();
582
    }
585
    }
583
586
584
    /* Wait for scripts to finish */
587
    wait_children();
585
    reap_kids();
586
    if (n_children > 0) {
587
	if (child_wait > 0)
588
	    TIMEOUT(childwait_end, NULL, child_wait);
589
	if (debug) {
590
	    struct subprocess *chp;
591
	    dbglog("Waiting for %d child processes...", n_children);
592
	    for (chp = children; chp != NULL; chp = chp->next)
593
		dbglog("  script %s, pid %d", chp->prog, chp->pid);
594
	}
595
	while (n_children > 0 && !childwait_done) {
596
	    handle_events();
597
	    if (kill_link && !childwait_done)
598
		childwait_end(NULL);
599
	}
600
    }
601
588
602
    die(status);
589
    die(status);
603
    return 0;
590
    return 0;
Lines 1776-1781 Link Here
1776
}
1763
}
1777
1764
1778
/*
1765
/*
1766
 * wait_children - wait for scripts to finish.
1767
 * if child_wait is 0, wait indefinitely.
1768
 * else, kill'em all at the end of timeout
1769
 */
1770
static void
1771
wait_children()
1772
{
1773
    /* Wait for scripts to finish */
1774
    reap_kids();
1775
    if (n_children > 0) {
1776
	childwait_done = 0;
1777
	if (child_wait > 0)
1778
	    TIMEOUT(childwait_end, NULL, child_wait);
1779
	if (debug) {
1780
	    struct subprocess *chp;
1781
	    dbglog("Waiting for %d child processes...", n_children);
1782
	    for (chp = children; chp != NULL; chp = chp->next)
1783
		dbglog("  script %s, pid %d", chp->prog, chp->pid);
1784
	}
1785
	while (n_children > 0 && !childwait_done) {
1786
	    handle_events();
1787
	    if (asked_to_quit && !childwait_done)
1788
		childwait_end(NULL);
1789
	}
1790
	if (child_wait > 0)
1791
	    UNTIMEOUT(childwait_end, NULL);
1792
    }
1793
}
1794
1795
/*
1779
 * childwait_end - we got fed up waiting for the child processes to
1796
 * childwait_end - we got fed up waiting for the child processes to
1780
 * exit, send them all a SIGTERM.
1797
 * exit, send them all a SIGTERM.
1781
 */
1798
 */

Return to bug 296267