X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flogfile.c;h=e13c09e7d471d4ccfc73800b908dfc281611aa39;hb=19b6d2624456ca0792c40aa46cc1774f9ad42443;hp=6d0f6e07826f2eb5391a64bc93db72e642948362;hpb=56e1979ea2d1a373c614cd71c902435f46090da1;p=collectd.git diff --git a/src/logfile.c b/src/logfile.c index 6d0f6e07..e13c09e7 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -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);