summaryrefslogtreecommitdiff
path: root/app/platform/stm32f0-gcc/retarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/platform/stm32f0-gcc/retarget.cpp')
-rw-r--r--app/platform/stm32f0-gcc/retarget.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/platform/stm32f0-gcc/retarget.cpp b/app/platform/stm32f0-gcc/retarget.cpp
index a6706d3..85e12b4 100644
--- a/app/platform/stm32f0-gcc/retarget.cpp
+++ b/app/platform/stm32f0-gcc/retarget.cpp
@@ -92,6 +92,12 @@ extern "C" ssize_t read(int fd, void *buf, size_t nbytes)
switch (file->type) {
case FileType::kUART:
ret = UARTRead(reinterpret_cast<UART*>(file->extra), buf, nbytes);
+ // XXX if fcntl support for disabling O_NONBLOCK will ever be added,
+ // then it has to something with this block of code
+ if (ret == 0) {
+ errno = EWOULDBLOCK;
+ ret = -1;
+ }
break;
case FileType::kUARTDirect:
ret = UARTReadDirect(reinterpret_cast<UART*>(file->extra), buf, nbytes);