summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2022-10-31 15:30:42 +0000
committerRyo Nakamura <upa@haeena.net>2022-10-31 15:30:42 +0000
commitd62fc2cddd5ced47bb33464b3c462346a5592295 (patch)
tree734c686bd04db8a88e34a524ec500315c12da55e
parent7039b84c4fe56c88d73f43eb30fcf1372d6263ed (diff)
do not print progress when total bytes transferred is 0
-rw-r--r--src/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 4022786..4524fd3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -496,6 +496,11 @@ static void print_progress(struct timeval *start, struct timeval *end,
#define array_size(a) (sizeof(a) / sizeof(a[0]))
+ if (total <= 0) {
+ pprint1("total 0 byte transferred");
+ return; /* copy 0-byte file(s) */
+ }
+
total_round = total;
for (byte_tu = 0; total_round > 1000 && byte_tu < array_size(byte_units) - 1;
byte_tu++)