From 57c885581078b06c0641307a60ff97be3ebec90b Mon Sep 17 00:00:00 2001 From: Nathan Huff Date: Thu, 24 Jan 2013 10:10:02 -0600 Subject: [PATCH] If the file isn't closed such as when logging to stdout or stderr the file must be flushed for it to get out of the IO buffers right away. Signed-off-by: Florian Forster --- src/logfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/logfile.c b/src/logfile.c index 6d0f6e07..e063dd08 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -164,8 +164,11 @@ static void logfile_print (const char *msg, int severity, time_t timestamp_time) else fprintf (fh, "%s%s\n", level_str, msg); - if (do_close != 0) + if (do_close != 0) { fclose (fh); + } else { + fflush(fh); + } } pthread_mutex_unlock (&file_lock); -- 2.30.2