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.
This commit is contained in:
Miroslav Lichvar 2018-08-28 14:04:44 +02:00
parent f5206db9b0
commit 6847536669

View file

@ -191,6 +191,9 @@ LOG_OpenFileLog(const char *log_file)
/* Enable line buffering */ /* Enable line buffering */
setvbuf(f, NULL, _IOLBF, BUFSIZ); setvbuf(f, NULL, _IOLBF, BUFSIZ);
if (file_log && file_log != stderr)
fclose(file_log);
file_log = f; file_log = f;
} }