From 2ca3bc02fda2de5eb85d8e15b1b0ad564150ec11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Mon, 15 Mar 2021 01:57:07 -0400 Subject: [PATCH] In XModem/YModem, when total_files reaches zero, stop downloading. --- src/syncterm/term.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/syncterm/term.c b/src/syncterm/term.c index 45658aa5c5..074f4353be 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -1838,7 +1838,8 @@ void xmodem_download(struct bbslist *bbs, long mode, char *path) break; if((cps=(unsigned)(file_bytes/t))==0) cps=1; - total_files--; + if (--total_files <= 0) + break; total_bytes-=file_bytes; if(total_files>1 && total_bytes) lprintf(LOG_INFO,"Remaining - Time: %lu:%02lu Files: %u KBytes: %"PRId64 -- GitLab