From e6f5bf7901b159ca1ba1147598e97da4e4bcff2c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 9 Aug 2024 19:19:04 +0200 Subject: [PATCH] ALways log to syslog when writing to the logfile failed Signed-off-by: DL6ER --- src/config/toml_reader.c | 6 ------ src/log.c | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/config/toml_reader.c b/src/config/toml_reader.c index de40703d..6f3f98e3 100644 --- a/src/config/toml_reader.c +++ b/src/config/toml_reader.c @@ -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 diff --git a/src/log.c b/src/log.c index e11e09a7..0d089e02 100644 --- a/src/log.c +++ b/src/log.c @@ -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);