From dcb93d60e6e8d5d7aa6fef3d981fa16a7a2c96d0 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 2 Oct 2018 18:25:53 +0100 Subject: [PATCH] pscp: fix another newline problem in output. In commit 54b300f15, I managed to set the progress_bar_displayed flag just _after_, rather than before, the call to abandon_progress_bar that moves to the new line once the file has finished copying. So in the case where a file is so small that the very first displaying of the transfer statistics is already at 100% completion, the flag wouldn't be set when abandon_progress_bar checked for it, and a newline still wouldn't be printed. --- pscp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pscp.c b/pscp.c index d99c8d83..67db1e9d 100644 --- a/pscp.c +++ b/pscp.c @@ -576,11 +576,11 @@ static void print_stats(const char *name, uint64 size, uint64 done, printf("%*s", prev_stats_len - len, ""); prev_stats_len = len; + progress_bar_displayed = TRUE; + if (uint64_compare(done, size) == 0) abandon_progress_bar(); - progress_bar_displayed = TRUE; - fflush(stdout); }