[PATCH] sysdeps-unix: use MSG_NOSIGNAL when sending creds
Scott James Remnant
scott at netsplit.com
Thu Dec 9 10:41:44 PST 2010
Since SIGPIPE is no longer touched by default when MSG_NOSIGNAL is
available, it's extra-critical that all socket writes actually pass
that flag.
---
dbus/dbus-sysdeps-unix.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 97a6a4a..8688ca2 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -1493,9 +1493,17 @@ write_credentials_byte (int server_fd,
again:
#if defined(HAVE_CMSGCRED)
- bytes_written = sendmsg (server_fd, &msg, 0);
+ bytes_written = sendmsg (server_fd, &msg, 0
+#ifdef MSG_NOSIGNAL
+ |MSG_NOSIGNAL
+#endif
+ );
#else
- bytes_written = write (server_fd, buf, 1);
+ bytes_written = send (server_fd, buf, 1, 0
+#ifdef MSG_NOSIGNAL
+ |MSG_NOSIGNAL
+#endif
+ );
#endif
if (bytes_written < 0 && errno == EINTR)
--
1.7.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20101209/b3d0b7ef/attachment.html>
More information about the dbus
mailing list