network plugin: Fix error message for GCRYCTL_INIT_SECMEM failure.
[collectd.git] / src / logfile.c
index 6d0f6e0..e13c09e 100644 (file)
@@ -95,7 +95,7 @@ static int logfile_config (const char *key, const char *value)
 static void logfile_print (const char *msg, int severity, time_t timestamp_time)
 {
        FILE *fh;
-       int do_close = 0;
+       _Bool do_close = 0;
        struct tm timestamp_tm;
        char timestamp_str[64];
        char level_str[16] = "";
@@ -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) {
                        fclose (fh);
+               } else {
+                       fflush(fh);
+               }
        }
 
        pthread_mutex_unlock (&file_lock);