From ccae52be0e9d2b421203eecf2021979143b75798 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 13 Mar 1997 14:53:55 +0000 Subject: Requested by: Harlan Stenn 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). --- usr.sbin/ppp/log.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'usr.sbin/ppp/log.c') diff --git a/usr.sbin/ppp/log.c b/usr.sbin/ppp/log.c index 479969a..2f57814 100644 --- a/usr.sbin/ppp/log.c +++ b/usr.sbin/ppp/log.c @@ -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(); +} -- cgit v1.1