From aa0af1ee883fd50ec3c2e6d8f32b6320f09c1143 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Thu, 9 Jun 2005 02:31:50 +0000 Subject: [PATCH] Treat read error (fread() returns 0) the same as EOF. --- src/sbbs3/zmodem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sbbs3/zmodem.c b/src/sbbs3/zmodem.c index 145a5b8471..9404df3196 100644 --- a/src/sbbs3/zmodem.c +++ b/src/sbbs3/zmodem.c @@ -1379,7 +1379,7 @@ int zmodem_send_from(zmodem_t* zm, FILE* fp, ulong pos, ulong fsize, ulong* sent /* * at end of file wait for an ACK - can't use feof() here! */ - if((ulong)ftell(fp) >= fsize) + if((ulong)ftell(fp) >= fsize || n==0) type = ZCRCW; zmodem_send_data(zm, type, zm->tx_data_subpacket, n); @@ -1407,6 +1407,11 @@ int zmodem_send_from(zmodem_t* zm, FILE* fp, ulong pos, ulong fsize, ulong* sent lprintf(zm,LOG_DEBUG,"zmodem_send_from: end of file (%ld)", fsize ); return ZACK; } + if(n==0) { + lprintf(zm,LOG_DEBUG,"zmodem_send_from: read error at offset %lu", ftell(fp) ); + return ZACK; + } + } /* -- GitLab