X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flogfile.c;h=0f20f3ca117d912b9df8b4d5118b93ee9660ead0;hb=a15042009febe214f7d5778e381bf990422f3b72;hp=ded7732b00ce22fcc648cbb8ae2207c53f26db94;hpb=b850c79322880d2b1936bc8babaf42e3657d942b;p=collectd.git diff --git a/src/logfile.c b/src/logfile.c index ded7732b..0f20f3ca 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -81,7 +81,7 @@ static void logfile_print (const char *msg, int severity, cdtime_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] = ""; @@ -151,8 +151,11 @@ static void logfile_print (const char *msg, int severity, 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);