This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 749ea3bb719 net/local: Fix the build of recvmsg with datagram sockets
off.
749ea3bb719 is described below
commit 749ea3bb719886989ba0ca5b68deac54cf018439
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Nov 5 14:35:30 2026 +0100
net/local: Fix the build of recvmsg with datagram sockets off.
With CONFIG_NET_LOCAL_DGRAM off, local_recvmsg() set buf, from and
fromlen and did not use them, so a build with -Werror failed. Use the
fields of the message in the datagram branch, the only user.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
net/local/local_recvmsg.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/net/local/local_recvmsg.c b/net/local/local_recvmsg.c
index 3ef8bc1478b..c8c51f6a7c7 100644
--- a/net/local/local_recvmsg.c
+++ b/net/local/local_recvmsg.c
@@ -662,9 +662,6 @@ errout_with_halfduplex:
ssize_t local_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
int flags)
{
- FAR socklen_t *fromlen = &msg->msg_namelen;
- FAR struct sockaddr *from = msg->msg_name;
- FAR void *buf;
ssize_t len;
if (msg->msg_iovlen == 0)
@@ -672,9 +669,6 @@ ssize_t local_recvmsg(FAR struct socket *psock, FAR struct
msghdr *msg,
return -EMSGSIZE;
}
- buf = msg->msg_iov->iov_base;
- len = msg->msg_iov->iov_len;
-
/* Check for a stream socket */
#ifdef CONFIG_NET_LOCAL_STREAM
@@ -693,8 +687,10 @@ ssize_t local_recvmsg(FAR struct socket *psock, FAR struct
msghdr *msg,
return -ENOTSUP;
}
- DEBUGASSERT(buf);
- len = psock_dgram_recvfrom(psock, buf, len, flags, from, fromlen);
+ DEBUGASSERT(msg->msg_iov->iov_base);
+ len = psock_dgram_recvfrom(psock, msg->msg_iov->iov_base,
+ msg->msg_iov->iov_len, flags,
+ msg->msg_name, &msg->msg_namelen);
}
else
#endif