From 763a09e1724b000e64f0441bc2e14f03ea607fc5 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Sat, 23 Jun 2018 11:42:23 -0700 Subject: [PATCH] Write to logfile as soon as we have the data, don't buffer. Logfiles are important to see what happend, in particular if something unexpected happened; so we want to make sure that the logfile is flushed to disk. Before this change, the logfile was typically written at the end in a large chunk as the default (large) buffering applied. Now, characters are written out ASAP, so it is possible to get a live-view with a tail -f --- src/log.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/log.c b/src/log.c index f246bc2..0bad55d 100644 --- a/src/log.c +++ b/src/log.c @@ -40,6 +40,7 @@ void log_open(const char *filename) log_error = true; exit(EXIT_FAILURE); } + setvbuf(fp, NULL, _IONBF, 0); } void log_write(char c)