]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
logging: close previous file log after opening new one
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 28 Aug 2018 12:04:44 +0000 (14:04 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 28 Aug 2018 13:42:38 +0000 (15:42 +0200)
Currently, the log is always opened only once, but that will change with
tests temporarily suspending logging.

logging.c

index aee6940568fd53881327dbc68682c1cafb4bbfb4..0f73a457c9d4c4652ce9003d9013578349381afd 100644 (file)
--- 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;
 }