From 68475366697e844aaffea576bf65633858d6eba6 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 28 Aug 2018 14:04:44 +0200 Subject: [PATCH] logging: close previous file log after opening new one Currently, the log is always opened only once, but that will change with tests temporarily suspending logging. --- logging.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/logging.c b/logging.c index aee6940..0f73a45 100644 --- a/logging.c +++ b/logging.c @@ -191,6 +191,9 @@ LOG_OpenFileLog(const char *log_file) /* Enable line buffering */ setvbuf(f, NULL, _IOLBF, BUFSIZ); + if (file_log && file_log != stderr) + fclose(file_log); + file_log = f; }