diff --git a/net/local/local_recvmsg.c b/net/local/local_recvmsg.c index 3ad99e6ade2..8998427c2e3 100644 --- a/net/local/local_recvmsg.c +++ b/net/local/local_recvmsg.c @@ -237,13 +237,19 @@ psock_stream_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, /* Verify that this is a connected peer socket */ - if (conn->lc_state != LOCAL_STATE_CONNECTED || - conn->lc_infile.f_inode == NULL) + if (conn->lc_state != LOCAL_STATE_CONNECTED) { nerr("ERROR: not connected\n"); return -ENOTCONN; } + /* Check shutdown state */ + + if (conn->lc_infile.f_inode == NULL) + { + return 0; + } + /* If it is non-blocking mode, the data in fifo is 0 and * returns directly */ diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c index deade9f75be..f0b999614a2 100644 --- a/net/local/local_sendmsg.c +++ b/net/local/local_sendmsg.c @@ -186,13 +186,19 @@ static ssize_t local_send(FAR struct socket *psock, * opened the outgoing FIFO for write-only access. */ - if (peer->lc_state != LOCAL_STATE_CONNECTED || - peer->lc_outfile.f_inode == NULL) + if (peer->lc_state != LOCAL_STATE_CONNECTED) { nerr("ERROR: not connected\n"); return -ENOTCONN; } + /* Check shutdown state */ + + if (peer->lc_outfile.f_inode == NULL) + { + return -EPIPE; + } + /* Send the packet */ ret = nxmutex_lock(&peer->lc_sendlock);