From 3e6ff6c22c08924d78af86e64444535035cf0d3e Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Sun, 22 Oct 2017 22:00:02 +0200 Subject: [PATCH] Fix PCLink Receive for files sized a multiple of 255 bytes Fix from Paul Reed: http://lists.inf.ethz.ch/pipermail/oberon/2017/010725.html --- src/pclink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pclink.c b/src/pclink.c index 5c4aa81..fa9ce3d 100644 --- a/src/pclink.c +++ b/src/pclink.c @@ -101,18 +101,18 @@ static uint32_t PCLink_RData(const struct RISC_Serial *serial) { } } else { int pos = (rxcount - fnlen - 1) % 256; - if (pos == 0) { + if (pos == 0 || flen == 0) { if (flen > 255) { ch = 255; } else { ch = (uint8_t)flen; + if (flen == 0) { + mode = 0; unlink(RecName); + } } } else { read(fd, &ch, 1); flen--; - if (flen == 0) { - mode = 0; unlink(RecName); - } } } }