From 6740c78e838b0b2322097de307fb41f1eeb60839 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 7 May 2018 11:46:09 +0200 Subject: [PATCH] poll: add stdout fflush after poll query ATM it's a bit ugly to enforce flushing of 'stdio' here, but works as quick hot-fix. log_print*() is using buffered I/O. But for pooling with typical 1s interval this may take a while before buffer about continues progress gets flushed. So ATM fflush(). TODO: either add log_print*_with_flush() or maybe directly use just line buffering with log_print() and only log_debug() keep using buffered I/O mode. --- tools/polldaemon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/polldaemon.c b/tools/polldaemon.c index 020be213e..05a47583c 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -80,6 +80,8 @@ static int _check_lv_status(struct cmd_context *cmd, } progress = parms->poll_fns->poll_progress(cmd, lv, name, parms); + fflush(stdout); + if (progress == PROGRESS_CHECK_FAILED) return_0; @@ -448,6 +450,7 @@ static int _report_progress(struct cmd_context *cmd, struct poll_operation_id *i ret = 0; goto out; } + fflush(stdout); ret = 1;