aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/progressmeter.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/progressmeter.c')
-rw-r--r--crypto/openssh/progressmeter.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/crypto/openssh/progressmeter.c b/crypto/openssh/progressmeter.c
index f1712da30df4..2c169768f60f 100644
--- a/crypto/openssh/progressmeter.c
+++ b/crypto/openssh/progressmeter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: progressmeter.c,v 1.54 2024/09/22 12:56:21 jsg Exp $ */
+/* $OpenBSD: progressmeter.c,v 1.56 2025/06/11 13:27:11 dtucker Exp $ */
/*
* Copyright (c) 2003 Nils Nordman. All rights reserved.
*
@@ -93,15 +93,15 @@ format_rate(off_t bytes)
bytes *= 100;
for (i = 0; bytes >= 100*1000 && unit[i] != 'T'; i++)
bytes = (bytes + 512) / 1024;
+ /* Display at least KB, even when rate is low or zero. */
if (i == 0) {
i++;
bytes = (bytes + 512) / 1024;
}
- snprintf(buf, sizeof(buf), "%3lld.%1lld%c%s",
+ snprintf(buf, sizeof(buf), "%3lld.%1lld%cB",
(long long) (bytes + 5) / 100,
(long long) (bytes + 5) / 10 % 10,
- unit[i],
- i ? "B" : " ");
+ unit[i]);
return buf;
}
@@ -132,7 +132,8 @@ refresh_progress_meter(int force_update)
int hours, minutes, seconds;
int file_len, cols;
- if ((!force_update && !alarm_fired && !win_resized) || !can_output())
+ if (file == NULL || (!force_update && !alarm_fired && !win_resized) ||
+ !can_output())
return;
alarm_fired = 0;
@@ -276,6 +277,7 @@ stop_progress_meter(void)
refresh_progress_meter(1);
atomicio(vwrite, STDOUT_FILENO, "\n", 1);
+ file = NULL;
}
static void