]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Flush stdout logs always (avoid problems when using pipes).
authorpcarana <pc.moreno2099@gmail.com>
Wed, 5 Feb 2020 23:56:57 +0000 (17:56 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Wed, 5 Feb 2020 23:56:57 +0000 (17:56 -0600)
src/log.c

index 9a5a2144ea9778b3fcad7f24b5a07860513dbe26..f0c4ab5f142d45ac563a68a2c5fe2bf8433aa784 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -120,6 +120,9 @@ __fprintf(int level, char const *format, ...)
                fprintf(lvl->stream, COLOR_RESET);
 
        fprintf(lvl->stream, "\n");
+       /* Force flush */
+       if (lvl->stream == stdout)
+               fflush(lvl->stream);
 }
 
 #define MSG_LEN 512
@@ -163,6 +166,9 @@ pr_stream(int level, const char *format, va_list args)
                fprintf(lvl->stream, "%s", COLOR_RESET);
 
        fprintf(lvl->stream, "\n");
+       /* Force flush */
+       if (lvl->stream == stdout)
+               fflush(lvl->stream);
 }
 
 #define PR_SIMPLE(level)                                               \