--- ppp-2.4.2/pppd/main.c.vns 2004-06-07 14:50:35 +0400 +++ ppp-2.4.2/pppd/main.c 2004-06-08 15:15:07 +0400 @@ -204,7 +204,6 @@ static void get_input __P((void)); static void calltimeout __P((void)); static struct timeval *timeleft __P((struct timeval *)); -static void kill_my_pg __P((int)); static void hup __P((int)); static void term __P((int)); static void chld __P((int)); @@ -1408,23 +1407,6 @@ /* - * kill_my_pg - send a signal to our process group, and ignore it ourselves. - */ -static void -kill_my_pg(sig) - int sig; -{ - struct sigaction act, oldact; - - act.sa_handler = SIG_IGN; - act.sa_flags = 0; - sigaction(sig, &act, &oldact); - kill(0, sig); - sigaction(sig, &oldact, NULL); -} - - -/* * hup - Catch SIGHUP signal. * * Indicates that the physical layer has been disconnected. @@ -1435,14 +1417,23 @@ hup(sig) int sig; { + static ignore_next = 0; + if(ignore_next) + { + ignore_next = 0; + return; + } info("Hangup (SIGHUP)"); got_sighup = 1; if (conn_running) - /* Send the signal to the [dis]connector process(es) also */ - kill_my_pg(sig); + { + /* Send the signal to the [dis]connector process(es) also */ + ignore_next = 1; + kill(0, sig); + } notify(sigreceived, sig); if (waiting) - siglongjmp(sigjmp, 1); + siglongjmp(sigjmp, 1); } @@ -1456,14 +1447,23 @@ term(sig) int sig; { + static ignore_next = 0; + if(ignore_next) + { + ignore_next = 0; + return; + } info("Terminating on signal %d.", sig); got_sigterm = 1; if (conn_running) - /* Send the signal to the [dis]connector process(es) also */ - kill_my_pg(sig); + { + /* Send the signal to the [dis]connector process(es) also */ + ignore_next = 1; + kill(0, sig); + } notify(sigreceived, sig); if (waiting) - siglongjmp(sigjmp, 1); + siglongjmp(sigjmp, 1); } @@ -1523,14 +1523,23 @@ bad_signal(sig) int sig; { + static ignore_next = 0; static int crashed = 0; + if(ignore_next) + { + ignore_next = 0; + return; + } if (crashed) - _exit(127); + _exit(127); crashed = 1; error("Fatal signal %d", sig); if (conn_running) - kill_my_pg(SIGTERM); + { + ignore_next = 1; + kill(0, SIGTERM); + } notify(sigreceived, sig); die(127); }