local_socket: recv should return 0 NOT -ECONNRESET if remote closed

ref:
https://man7.org/linux/man-pages/man2/recv.2.html

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2021-10-15 18:02:21 +08:00
committed by Alin Jerpelea
parent 1970ce5116
commit 391ccdc42b
+4 -5
View File
@@ -53,13 +53,13 @@
* buf - Local to store the received data * buf - Local to store the received data
* len - Length of data to receive [in] * len - Length of data to receive [in]
* Length of data actually received [out] * Length of data actually received [out]
* Zero means *len[in] is zero,
* or the sending side has closed the FIFO
* once - Flag to indicate the buf may only be read once * once - Flag to indicate the buf may only be read once
* *
* Returned Value: * Returned Value:
* Zero is returned on success; a negated errno value is returned on any * Zero is returned on success; a negated errno value is returned on any
* failure. If -ECONNRESET is received, then the sending side has closed * failure.
* the FIFO. In this case, the returned data may still be valid (if the
* returned len > 0).
* *
****************************************************************************/ ****************************************************************************/
@@ -93,8 +93,7 @@ int local_fifo_read(FAR struct file *filep, FAR uint8_t *buf,
* has closed the FIFO. * has closed the FIFO.
*/ */
ret = -ECONNRESET; break;
goto errout;
} }
else else
{ {