View | Details | Raw Unified | Return to bug 10095
Collapse All | Expand All

(-)ppp-2.4.2/pppd/main.c (-9 / +15 lines)
Lines 177-182 Link Here
177
177
178
int error_count;
178
int error_count;
179
179
180
sigset_t ignored_signals; /* to be ignored due to kill_my_pg() call */
181
180
/*
182
/*
181
 * We maintain a list of child process pids and
183
 * We maintain a list of child process pids and
182
 * functions to call when they exit.
184
 * functions to call when they exit.
Lines 217-223 Link Here
217
static void cleanup_db __P((void));
219
static void cleanup_db __P((void));
218
#endif
220
#endif
219
221
220
static void handle_events __P((void));
221
static void print_link_stats __P((void));
222
static void print_link_stats __P((void));
222
223
223
extern	char	*ttyname __P((int));
224
extern	char	*ttyname __P((int));
Lines 644-650 Link Here
644
/*
647
/*
645
 * handle_events - wait for something to happen and respond to it.
648
 * handle_events - wait for something to happen and respond to it.
646
 */
649
 */
647
static void
650
void
648
handle_events()
651
handle_events()
649
{
652
{
650
    struct timeval timo;
653
    struct timeval timo;
Lines 767-772 Link Here
767
     * be sufficient.
770
     * be sufficient.
768
     */
771
     */
769
    signal(SIGPIPE, SIG_IGN);
772
    signal(SIGPIPE, SIG_IGN);
773
774
    sigemptyset(&ignored_signals);
770
}
775
}
771
776
772
/*
777
/*
Lines 1334-1346 Link Here
1334
kill_my_pg(sig)
1339
kill_my_pg(sig)
1335
    int sig;
1340
    int sig;
1336
{
1341
{
1337
    struct sigaction act, oldact;
1342
    if (sigismember(&ignored_signals, sig))
1338
1343
    {
1339
    act.sa_handler = SIG_IGN;
1344
	sigdelset(&ignored_signals, sig);
1340
    act.sa_flags = 0;
1345
    }
1341
    sigaction(sig, &act, &oldact);
1346
    else
1342
    kill(0, sig);
1347
    {
1343
    sigaction(sig, &oldact, NULL);
1348
	sigaddset(&ignored_signals, sig);
1349
	kill(0, sig);
1350
    }
1344
}
1351
}
1345
1352
1346
1353
Lines 1382-1387 Link Here
1382
	/* Send the signal to the [dis]connector process(es) also */
1389
	/* Send the signal to the [dis]connector process(es) also */
1383
	kill_my_pg(sig);
1390
	kill_my_pg(sig);
1384
    notify(sigreceived, sig);
1391
    notify(sigreceived, sig);
1392
    status = EXIT_USER_REQUEST;
1385
    if (waiting)
1393
    if (waiting)
1386
	siglongjmp(sigjmp, 1);
1394
	siglongjmp(sigjmp, 1);
1387
}
1395
}
(-)ppp-2.4.2/pppd/pppd.h (+1 lines)
Lines 456-461 Link Here
456
 */
456
 */
457
457
458
/* Procedures exported from main.c. */
458
/* Procedures exported from main.c. */
459
void handle_events __P((void));	/* wait for smth to happen and respond to it*/
459
void set_ifunit __P((int));	/* set stuff that depends on ifunit */
460
void set_ifunit __P((int));	/* set stuff that depends on ifunit */
460
void detach __P((void));	/* Detach from controlling tty */
461
void detach __P((void));	/* Detach from controlling tty */
461
void die __P((int));		/* Cleanup and exit */
462
void die __P((int));		/* Cleanup and exit */
(-)ppp-2.4.2/pppd/sys-linux.c (-1 / +3 lines)
Lines 995-1001 Link Here
995
	if (!default_device)
995
	if (!default_device)
996
	    inittermios.c_lflag &= ~(ECHO | ECHONL);
996
	    inittermios.c_lflag &= ~(ECHO | ECHONL);
997
997
998
	if (tcsetattr(tty_fd, TCSAFLUSH, &inittermios) < 0) {
998
	// Ugly hack - with TCSAFLUSH it hangs if no modem is connected
999
	// to COM port.
1000
	if (tcsetattr(tty_fd, TCSANOW, &inittermios) < 0) {
999
	    if (! ok_error (errno))
1001
	    if (! ok_error (errno))
1000
		warn("tcsetattr: %m (line %d)", __LINE__);
1002
		warn("tcsetattr: %m (line %d)", __LINE__);
1001
	}
1003
	}
(-)ppp-2.4.2/pppd/tty.c (-1 / +5 lines)
Lines 671-676 Link Here
671
				status = EXIT_INIT_FAILED;
671
				status = EXIT_INIT_FAILED;
672
				return -1;
672
				return -1;
673
			}
673
			}
674
			handle_events();
674
			if (kill_link) {
675
			if (kill_link) {
675
				disconnect_tty();
676
				disconnect_tty();
676
				return -1;
677
				return -1;
Lines 681-689 Link Here
681
		if (connector && connector[0]) {
682
		if (connector && connector[0]) {
682
			if (device_script(connector, ttyfd, ttyfd, 0) < 0) {
683
			if (device_script(connector, ttyfd, ttyfd, 0) < 0) {
683
				error("Connect script failed");
684
				error("Connect script failed");
684
				status = EXIT_CONNECT_FAILED;
685
				if (status != EXIT_USER_REQUEST)
686
				    status = EXIT_CONNECT_FAILED;
685
				return -1;
687
				return -1;
686
			}
688
			}
689
			handle_events();
687
			if (kill_link) {
690
			if (kill_link) {
688
				disconnect_tty();
691
				disconnect_tty();
689
				return -1;
692
				return -1;
Lines 710-715 Link Here
710
				error("Failed to reopen %s: %m", devnam);
713
				error("Failed to reopen %s: %m", devnam);
711
				status = EXIT_OPEN_FAILED;
714
				status = EXIT_OPEN_FAILED;
712
			}
715
			}
716
			handle_events();
713
			if (!persist || errno != EINTR || hungup || kill_link)
717
			if (!persist || errno != EINTR || hungup || kill_link)
714
				return -1;
718
				return -1;
715
		}
719
		}

Return to bug 10095