From: pcarana Date: Wed, 5 Feb 2020 23:56:57 +0000 (-0600) Subject: Flush stdout logs always (avoid problems when using pipes). X-Git-Tag: v1.2.0~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6cdb86e4dbcc7ac408f1351c29e11e80b681f125;p=thirdparty%2FFORT-validator.git Flush stdout logs always (avoid problems when using pipes). --- diff --git a/src/log.c b/src/log.c index 9a5a2144..f0c4ab5f 100644 --- 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) \