Requested by: Harlan Stenn <Harlan.Stenn@pfcs.com>
Accept SIGHUP as a "re-open logfile" signal. As ppp doesn't set it's serial line to it's controlling terminal, we can use HUP :) This is a candidate for 2.2. The log.[ch] changes won't conflict, but the main.c changes will. We just want to change the kill(...,SIGHUP) to a SIGTERM and change the signal(SIGHUP,Hangup) to a pending_signal(SIGHUP,LogReOpen).
This commit is contained in:
parent
01b21ff640
commit
c6c740be8b
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: log.c,v 1.7 1997/02/22 16:10:26 peter Exp $
|
||||
*
|
||||
*/
|
||||
#include "defs.h"
|
||||
@ -280,3 +280,28 @@ va_dcl
|
||||
vlogprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
LogReOpen( sig )
|
||||
int sig;
|
||||
{
|
||||
FILE *nlogfile;
|
||||
|
||||
#ifdef USELOGFILE
|
||||
nlogfile = fopen(LOGFILE, "a");
|
||||
if (nlogfile == NULL) {
|
||||
LogPrintf(~0,"can't re-open %s.\r\n", LOGFILE);
|
||||
}
|
||||
else {
|
||||
LogPrintf(~0,"log file closed due to signal %d.\r\n",sig);
|
||||
LogFlush();
|
||||
fclose(logfile);
|
||||
logfile = nlogfile;
|
||||
logptr = logbuff;
|
||||
logcnt = 0;
|
||||
logtop = lognext = NULL;
|
||||
LogPrintf(~0,"log file opened due to signal %d.\r\n",sig);
|
||||
}
|
||||
#endif
|
||||
LogFlush();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: log.h,v 1.8 1997/02/22 16:10:27 peter Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -62,6 +62,7 @@ extern int loglevel;
|
||||
|
||||
extern void LogTimeStamp __P((void));
|
||||
extern int LogOpen __P((void));
|
||||
extern void LogReOpen __P((int));
|
||||
extern void DupLog __P((void));
|
||||
extern void LogClose __P((void));
|
||||
extern void logprintf __P((char *, ...)), LogPrintf __P((int, char *, ...));
|
||||
|
@ -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.37 1997/03/10 06:21:01 ache Exp $
|
||||
* $Id: main.c,v 1.38 1997/03/13 12:45:30 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Add commands for traffic summary, version display, etc.
|
||||
@ -187,7 +187,7 @@ int signo;
|
||||
abort();
|
||||
}
|
||||
if (BGPid) {
|
||||
kill (BGPid, SIGHUP);
|
||||
kill (BGPid, SIGTERM);
|
||||
exit (EX_HANGUP);
|
||||
}
|
||||
else {
|
||||
@ -349,7 +349,7 @@ char **argv;
|
||||
|
||||
tcgetattr(0, &oldtio); /* Save original tty mode */
|
||||
|
||||
signal(SIGHUP, Hangup);
|
||||
pending_signal(SIGHUP, LogReOpen);
|
||||
pending_signal(SIGTERM, CloseSession);
|
||||
pending_signal(SIGINT, CloseSession);
|
||||
pending_signal(SIGQUIT, CloseSession);
|
||||
|
Loading…
Reference in New Issue
Block a user