]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
logging: enable line buffering of file log
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 26 Jul 2017 15:31:34 +0000 (17:31 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Aug 2017 13:37:59 +0000 (15:37 +0200)
The file log specified with the -l option should have the messages as
soon as they are produced.

logging.c

index a87aca363d1f084ae558069018035835a06de777..b39c4d52bf6a05c831908e72ae995f55478462c9 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -188,6 +188,9 @@ LOG_OpenFileLog(const char *log_file)
   if (!f)
     LOG_FATAL("Could not open log file %s", log_file);
 
+  /* Enable line buffering */
+  setvbuf(f, NULL, _IOLBF, BUFSIZ);
+
   file_log = f;
 }