From 6f995e377c57342a144ad3f5be8df367587d4765 Mon Sep 17 00:00:00 2001 From: Peter Bee Date: Fri, 12 Mar 2021 15:33:16 +0800 Subject: [PATCH] fix local_sendmsg return length Signed-off-by: Peter Bee --- net/local/local_sendmsg.c | 9 --------- net/local/local_sendpacket.c | 8 ++++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c index 7a7f74b5f8c74..745d4c7b95ffa 100644 --- a/net/local/local_sendmsg.c +++ b/net/local/local_sendmsg.c @@ -92,15 +92,6 @@ static ssize_t local_send(FAR struct socket *psock, /* Send the packet */ ret = local_send_packet(&peer->lc_outfile, buf, len); - - /* If the send was successful, then the full packet will have been - * sent - */ - - if (ret >= 0) - { - ret = len; - } } break; #endif /* CONFIG_NET_LOCAL_STREAM */ diff --git a/net/local/local_sendpacket.c b/net/local/local_sendpacket.c index 90b06360cf4ea..8dd2f1491f4d1 100644 --- a/net/local/local_sendpacket.c +++ b/net/local/local_sendpacket.c @@ -120,8 +120,8 @@ static int local_fifo_write(FAR struct file *filep, FAR const uint8_t *buf, * len Length of data to send * * Returned Value: - * Zero is returned on success; a negated errno value is returned on any - * failure. + * Packet length is returned on success; a negated errno value is returned + * on any failure. * ****************************************************************************/ @@ -158,10 +158,10 @@ int local_send_packet(FAR struct file *filep, FAR const struct iovec *buf, if (ret < 0) break; else - len16 += ret; + len16 += iov->iov_len; } - if (ret > 0) + if (ret == OK) ret = len16; } }