bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] lwip: Fix bug: Clear MSG_NOSIGNAL flag when calling send().


From: Joan Lledó
Subject: [PATCH 2/2] lwip: Fix bug: Clear MSG_NOSIGNAL flag when calling send().
Date: Sat, 4 May 2019 10:19:59 +0200

Lwip 2.1.2 added a new assertion to ensure that no unsupported flags
are being sent to lwip_sendmsg(). MSG_NOSIGNAL is one of these flags
and name resolving stopped working.

* lwip/socket-ops.c: lwip_S_socket_send():
        * Clear MSG_NOSIGNAL to ensure is not sent to lwip_sendmsg().
---
 lwip/socket-ops.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lwip/socket-ops.c b/lwip/socket-ops.c
index ed506ce9..decba3f8 100644
--- a/lwip/socket-ops.c
+++ b/lwip/socket-ops.c
@@ -347,11 +347,11 @@ lwip_S_socket_send (struct sock_user * user,
   int sent;
   int sockflags;
   struct iovec iov = { data, datalen };
-struct msghdr m = { msg_name:addr ? &addr->address : 0,
-  msg_namelen:addr ? addr->address.sa.sa_len : 0,
-  msg_flags:flags,
-  msg_controllen: 0, msg_iov: &iov, msg_iovlen:1
-  };
+  struct msghdr m = { msg_name:addr ? &addr->address : 0,
+    msg_namelen:addr ? addr->address.sa.sa_len : 0,
+    msg_flags:flags,
+    msg_controllen: 0, msg_iov: &iov, msg_iovlen:1
+    };
 
   if (!user)
     return EOPNOTSUPP;
@@ -361,8 +361,11 @@ struct msghdr m = { msg_name:addr ? &addr->address : 0,
     return EINVAL;
 
   sockflags = lwip_fcntl (user->sock->sockno, F_GETFL, 0);
+  /* XXX: missing !MSG_NOSIGNAL support, i.e. generate SIGPIPE */
+  flags &= ~MSG_NOSIGNAL;
   if (sockflags & O_NONBLOCK)
     flags |= MSG_DONTWAIT;
+
   sent = lwip_sendmsg (user->sock->sockno, &m, flags);
 
   /* MiG should do this for us, but it doesn't. */
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]