diff options
author | Paul Mackerras <paulus@samba.org> | 2004-11-13 12:05:48 +0000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2004-11-13 12:05:48 +0000 |
commit | 802908571f0d76c143db276c5988ae3f2307bd67 (patch) | |
tree | d94c6f8617e729b84ec81eb430e3d1252ad77905 /pppd/main.c | |
parent | 2b57066d4be7c7568631ee2530ae2cb3f81b8031 (diff) | |
download | ppp-802908571f0d76c143db276c5988ae3f2307bd67.tar.gz |
Make SIGHUP just take down the link now, not the bundle.
Be a bit more careful about quitting when we get a SIGTERM
or SIGINT.
Diffstat (limited to 'pppd/main.c')
-rw-r--r-- | pppd/main.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pppd/main.c b/pppd/main.c index 862a2d4..65a8877 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -66,7 +66,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: main.c,v 1.147 2004/11/13 12:02:22 paulus Exp $" +#define RCSID "$Id: main.c,v 1.148 2004/11/13 12:05:48 paulus Exp $" #include <stdio.h> #include <ctype.h> @@ -172,6 +172,7 @@ int devfd = -1; /* fd of underlying device */ int fd_ppp = -1; /* fd for talking PPP */ int phase; /* where the link is at */ int kill_link; +int asked_to_quit; int open_ccp_flag; int listen_time; int got_sigusr2; @@ -511,13 +512,13 @@ main(argc, argv) add_fd(fd_loop); for (;;) { handle_events(); - if (kill_link && !persist) + if (asked_to_quit) break; if (get_loop_output()) break; } remove_fd(fd_loop); - if (kill_link && !persist) + if (asked_to_quit) break; /* @@ -536,9 +537,10 @@ main(argc, argv) while (phase != PHASE_DEAD) { handle_events(); get_input(); - if (kill_link) { - bundle_terminating = 1; + if (kill_link) lcp_close(0, "User request"); + if (asked_to_quit) { + bundle_terminating = 1; if (phase == PHASE_MASTER) mp_bundle_terminated(); } @@ -550,7 +552,7 @@ main(argc, argv) } } - if (!persist || (maxfail > 0 && unsuccess >= maxfail)) + if (!persist || asked_to_quit || (maxfail > 0 && unsuccess >= maxfail)) break; if (demand) @@ -624,6 +626,7 @@ handle_events() if (got_sigterm) { info("Terminating on signal %d", got_sigterm); kill_link = 1; + asked_to_quit = 1; persist = 0; status = EXIT_USER_REQUEST; got_sigterm = 0; |