Do an openlog() on fallback to syslog
This commit is contained in:
parent
26b4ab07a4
commit
9c68b94136
18
src/log.c
18
src/log.c
@ -248,14 +248,7 @@ void send_stored_logs (void)
|
|||||||
*/
|
*/
|
||||||
int setup_logging (void)
|
int setup_logging (void)
|
||||||
{
|
{
|
||||||
/* Write to a user supplied log file if it's defined. This will
|
if (!config.syslog) {
|
||||||
* override using the syslog even if syslog is defined. */
|
|
||||||
if (config.syslog) {
|
|
||||||
if (config.godaemon == TRUE)
|
|
||||||
openlog ("tinyproxy", LOG_PID, LOG_DAEMON);
|
|
||||||
else
|
|
||||||
openlog ("tinyproxy", LOG_PID, LOG_USER);
|
|
||||||
} else {
|
|
||||||
if (open_log_file (config.logf_name) < 0) {
|
if (open_log_file (config.logf_name) < 0) {
|
||||||
/*
|
/*
|
||||||
* If opening the log file fails, we try
|
* If opening the log file fails, we try
|
||||||
@ -268,11 +261,16 @@ int setup_logging (void)
|
|||||||
config.logf_name, strerror (errno));
|
config.logf_name, strerror (errno));
|
||||||
log_message (LOG_CRIT,
|
log_message (LOG_CRIT,
|
||||||
"Falling back to syslog logging\n");
|
"Falling back to syslog logging\n");
|
||||||
} else {
|
|
||||||
config.syslog = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.syslog) {
|
||||||
|
if (config.godaemon == TRUE)
|
||||||
|
openlog ("tinyproxy", LOG_PID, LOG_DAEMON);
|
||||||
|
else
|
||||||
|
openlog ("tinyproxy", LOG_PID, LOG_USER);
|
||||||
|
}
|
||||||
|
|
||||||
logging_initialized = TRUE;
|
logging_initialized = TRUE;
|
||||||
send_stored_logs ();
|
send_stored_logs ();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user