Skip to content
Snippets Groups Projects
Commit aa0af1ee authored by rswindell's avatar rswindell
Browse files

Treat read error (fread() returns 0) the same as EOF.

parent 90fff93a
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment