Make HUP cause an exit (as it used to), and make

INT cause a hangup - not exiting for -ddial & -auto.

HUP must exit because init sends this at system shutdown
time (why, I don't know), and we don't want to end up
redialing after the HUP (due to another dfilter packet).

Pointed out by and discussed with: ache
This commit is contained in:
Brian Somers 1997-07-01 21:31:28 +00:00
parent da6360324e
commit 873725cc51
4 changed files with 17 additions and 55 deletions

View File

@ -18,7 +18,7 @@
* Columbus, OH 43221
* (614)451-1883
*
* $Id: chat.c,v 1.26 1997/06/09 03:27:15 brian Exp $
* $Id: chat.c,v 1.27 1997/06/23 23:10:05 brian Exp $
*
* TODO:
* o Support more UUCP compatible control sequences.
@ -553,7 +553,7 @@ ExpectString(char *str)
}
static jmp_buf ChatEnv;
static void (*ohup)(int), (*oint)(int);
static void (*oint)(int);
static void
StopDial(int sig)
@ -569,16 +569,12 @@ DoChat(char *script)
char **argv;
int argc, n, state;
/* While we're chatting, we want a HUP/INT to fail us */
/* While we're chatting, we want an INT to fail us */
if (setjmp(ChatEnv)) {
signal(SIGHUP, ohup);
signal(SIGINT, oint);
return(-1);
}
ohup = signal(SIGHUP, SIG_IGN);
oint = signal(SIGINT, SIG_IGN);
signal(SIGHUP, StopDial);
signal(SIGINT, StopDial);
oint = signal(SIGINT, StopDial);
timeout_next = abort_next = 0;
for (n = 0; AbortStrings[n]; n++) {
@ -609,12 +605,10 @@ DoChat(char *script)
HangupModem();
#endif
case NOMATCH:
signal(SIGHUP, ohup);
signal(SIGINT, oint);
return(NOMATCH);
}
}
signal(SIGHUP, ohup);
signal(SIGINT, oint);
return(MATCH);
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: main.c,v 1.67 1997/06/25 19:30:01 brian Exp $
* $Id: main.c,v 1.68 1997/06/29 13:54:31 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@ -192,11 +192,11 @@ int excode;
}
static void
Hangup(signo)
CloseConnection(signo)
int signo;
{
/* NOTE, these are manual, we've done a setsid() */
LogPrintf(LogPHASE, "Hangup: Caught signal %d, abort connection\n", signo);
LogPrintf(LogPHASE, "Caught signal %d, abort connection\n", signo);
reconnectState = RECON_FALSE; \
reconnectCount = 0; \
DownConnection();
@ -366,9 +366,9 @@ char **argv;
tcgetattr(0, &oldtio); /* Save original tty mode */
pending_signal(SIGHUP, Hangup);
pending_signal(SIGHUP, CloseSession);
pending_signal(SIGTERM, CloseSession);
pending_signal(SIGINT, CloseSession);
pending_signal(SIGINT, CloseConnection);
pending_signal(SIGQUIT, CloseSession);
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.42 1997/06/25 19:30:03 brian Exp $
.\" $Id: ppp.8,v 1.43 1997/06/30 03:03:35 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -1267,7 +1267,7 @@ using
deals with the following signals:
.Bl -tag -width 20
.It HUP
.It INT
Receipt of this signal causes the termination of the current connection
(if any). This will cause
.Nm
@ -1275,25 +1275,9 @@ to exit unless it is in
.Fl auto
or
.Fl ddial
mode. It should be noted that unless in
.Fl direct
mode,
.Nm
does not have a controlling terminal and therefore doesn't receive
this signal on loss of carrier. Instead, it monitors the line
directly for loss of carrier.
mode.
.It INT
This signal will normally terminate
.Nm ppp .
If, however,
.Nm
is in interactive mode this signal will be ignored except when dialing.
When dialing, the signal causes
.Nm
to abort dialing and return to the command prompt.
.It TERM & QUIT
.It HUP, TERM & QUIT
These signals tell
.Nm
to exit.

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.42 1997/06/25 19:30:03 brian Exp $
.\" $Id: ppp.8,v 1.43 1997/06/30 03:03:35 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -1267,7 +1267,7 @@ using
deals with the following signals:
.Bl -tag -width 20
.It HUP
.It INT
Receipt of this signal causes the termination of the current connection
(if any). This will cause
.Nm
@ -1275,25 +1275,9 @@ to exit unless it is in
.Fl auto
or
.Fl ddial
mode. It should be noted that unless in
.Fl direct
mode,
.Nm
does not have a controlling terminal and therefore doesn't receive
this signal on loss of carrier. Instead, it monitors the line
directly for loss of carrier.
mode.
.It INT
This signal will normally terminate
.Nm ppp .
If, however,
.Nm
is in interactive mode this signal will be ignored except when dialing.
When dialing, the signal causes
.Nm
to abort dialing and return to the command prompt.
.It TERM & QUIT
.It HUP, TERM & QUIT
These signals tell
.Nm
to exit.