You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2021/11/02 07:59:15 UTC

[incubator-nuttx] 02/02: local_socket: recv should return 0 NOT -ECONNRESET if remote closed

This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 391ccdc42b16ec634c0dd82d3ff81efb0300dd8e
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Oct 15 18:02:21 2021 +0800

    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 <li...@xiaomi.com>
---
 net/local/local_recvutils.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/net/local/local_recvutils.c b/net/local/local_recvutils.c
index de5170c..cdead61 100644
--- a/net/local/local_recvutils.c
+++ b/net/local/local_recvutils.c
@@ -53,13 +53,13 @@
  *   buf   - Local to store the received data
  *   len   - Length of data to receive [in]
  *           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
  *
  * Returned Value:
  *   Zero is returned on success; a negated errno value is returned on any
- *   failure.  If -ECONNRESET is received, then the sending side has closed
- *   the FIFO. In this case, the returned data may still be valid (if the
- *   returned len > 0).
+ *   failure.
  *
  ****************************************************************************/
 
@@ -93,8 +93,7 @@ int local_fifo_read(FAR struct file *filep, FAR uint8_t *buf,
            * has closed the FIFO.
            */
 
-          ret = -ECONNRESET;
-          goto errout;
+            break;
         }
       else
         {