From 9866f01908faa8171cdb6b3651be24e154fba36e Mon Sep 17 00:00:00 2001 From: Peter Bee Date: Fri, 12 Mar 2021 15:33:16 +0800 Subject: [PATCH] net/local: fix sendmsg return length MIRTOS-495 Return correct length now Signed-off-by: Peter Bee Change-Id: I32e3bfc44d8aabd3c19963486cb43962a38f927f --- net/local/local_sendmsg.c | 7 ------- net/local/local_sendpacket.c | 8 ++++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c index 1ed7ad289d0..59918dd0149 100644 --- a/net/local/local_sendmsg.c +++ b/net/local/local_sendmsg.c @@ -105,13 +105,6 @@ static ssize_t local_send(FAR struct socket *psock, FAR const void *buf, /* 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 7cf2e2096cf..d76abc28053 100644 --- a/net/local/local_sendpacket.c +++ b/net/local/local_sendpacket.c @@ -135,8 +135,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. * ****************************************************************************/ @@ -173,10 +173,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; } }