From b49a76bb209b9eeed4853e1daa37e4ee658e3585 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 11 Feb 2020 13:30:26 +1100 Subject: [PATCH] AP_Filesystem: fixed EOF on file read should return number of bytes read. This fixes an issue with MAVProxy ftp client --- libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp b/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp index 4501b75a00..1dfec099ed 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp @@ -414,7 +414,10 @@ ssize_t AP_Filesystem::read(int fd, void *buf, size_t count) errno = fatfs_to_errno((FRESULT)res); return -1; } - if (size > n || size == 0) { + if (size == 0) { + break; + } + if (size > n) { errno = EIO; return -1; }