mirror of
https://github.com/apache/nuttx.git
synced 2025-12-08 02:32:54 +08:00
The empty FIFO can happen only in two cases. Either there is some inconsistency that made rx_sem ready but buffer is empty (that might happen if multiple reads are blocked in parallel, or just due to the bug in the logic), or if close is used. Until now the 0 would be returned and thus EOF. The error is not EOF and actually it is still possible to read afterwards. Thus we for sure should not signal EOF for the first cause. The second cause for close matches the behavior that is expressed even on glibc for some file descriptors (the waiting read will commonly get error EINVAL there). We can't decide on the real cause of this situation and thus we always report EIO error and thus generic input/output error. Signed-off-by: Karel Kočí <kkoci@elektroline.cz>