mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
ALways log to syslog when writing to the logfile failed
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -141,12 +141,6 @@ bool readFTLtoml(struct config *oldconf, struct config *newconf,
|
||||
struct conf_item *old_conf_item = oldconf != NULL ? get_conf_item(oldconf, i) : NULL;
|
||||
struct conf_item *new_conf_item = get_conf_item(newconf, i);
|
||||
|
||||
// Do not read config.files.log.ftl from the TOML file if it has been
|
||||
// set to NULL due to permissions issues during startup
|
||||
if(config.files.log.ftl.v.s == NULL &&
|
||||
new_conf_item == &newconf->files.log.ftl)
|
||||
continue;
|
||||
|
||||
// First try to read this config option from an environment variable
|
||||
// Skip reading environment variables when importing from Teleporter
|
||||
// If this succeeds, skip searching the TOML file for this config item
|
||||
|
||||
@@ -289,6 +289,7 @@ void __attribute__ ((format (printf, 3, 4))) _FTL_log(const int priority, const
|
||||
va_end(args);
|
||||
add_to_fifo_buffer(FIFO_FTL, buffer, prio, len > MAX_MSG_FIFO ? MAX_MSG_FIFO : len);
|
||||
|
||||
bool logged = false;
|
||||
if(config.files.log.ftl.v.s != NULL)
|
||||
{
|
||||
// Open log file
|
||||
@@ -310,6 +311,8 @@ void __attribute__ ((format (printf, 3, 4))) _FTL_log(const int priority, const
|
||||
|
||||
// Close file after writing
|
||||
fclose(logfile);
|
||||
|
||||
logged = true;
|
||||
}
|
||||
else if(!daemonmode)
|
||||
{
|
||||
@@ -317,7 +320,7 @@ void __attribute__ ((format (printf, 3, 4))) _FTL_log(const int priority, const
|
||||
syslog(LOG_ERR, "Writing to FTL\'s log file failed!");
|
||||
}
|
||||
}
|
||||
else
|
||||
if(!logged)
|
||||
{
|
||||
// Syslog logging
|
||||
va_start(args, format);
|
||||
|
||||
Reference in New Issue
Block a user