diff options
Diffstat (limited to 'src/helper')
-rw-r--r-- | src/helper/log.c | 9 | ||||
-rw-r--r-- | src/helper/log.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/helper/log.c b/src/helper/log.c index caa0a66..6865607 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -302,6 +302,15 @@ void log_init(void) start = last_time = timeval_ms(); } +void log_exit(void) +{ + if (log_output && log_output != stderr) { + /* Close log file, if it was open and wasn't stderr. */ + fclose(log_output); + } + log_output = NULL; +} + int set_log_output(struct command_context *cmd_ctx, FILE *output) { log_output = output; diff --git a/src/helper/log.h b/src/helper/log.h index 621d467..f0378ae 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -72,6 +72,7 @@ __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6))); * Initialize logging module. Call during program startup. */ void log_init(void); +void log_exit(void); int set_log_output(struct command_context *cmd_ctx, FILE *output); int log_register_commands(struct command_context *cmd_ctx); |