freebsd-skq/contrib/ntp/sntp/log.c
Gleb Smirnoff 9034852c84 MFV ntp-4.2.8p4 (r289715)
Security:       VuXML: c4a18a12-77fc-11e5-a687-206a8a720317
Security:	CVE-2015-7871
Security:	CVE-2015-7855
Security:	CVE-2015-7854
Security:	CVE-2015-7853
Security:	CVE-2015-7852
Security:	CVE-2015-7851
Security:	CVE-2015-7850
Security:	CVE-2015-7849
Security:	CVE-2015-7848
Security:	CVE-2015-7701
Security:	CVE-2015-7703
Security:	CVE-2015-7704, CVE-2015-7705
Security:	CVE-2015-7691, CVE-2015-7692, CVE-2015-7702
Security:	http://support.ntp.org/bin/view/Main/SecurityNotice#October_2015_NTP_Security_Vulner
Sponsored by:	Nginx, Inc.
2015-10-22 19:42:57 +00:00

48 lines
754 B
C

#include <config.h>
#include "log.h"
const char *progname; /* for msyslog use too */
static int counter = 0;
static void cleanup_log(void);
void
sntp_init_logging(
const char *prog
)
{
msyslog_term = TRUE;
init_logging(prog, 0, FALSE);
msyslog_term_pid = FALSE;
msyslog_include_timestamp = FALSE;
}
void
open_logfile(
const char *logfile
)
{
change_logfile(logfile, FALSE);
counter = 1; //counter++;
atexit(cleanup_log);
}
//not sure about this. Are the atexit() functions called by FIFO or LIFO order? The end result is PROBABLY the same
static void
cleanup_log(void)
{
//counter--;
//if(counter <= 0){
if(counter == 1){
syslogit = TRUE;
fflush(syslog_file);
fclose(syslog_file);
syslog_file = NULL;
counter = 0;
}
}