summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott James Remnant <scott@netsplit.com>2010-12-16 11:11:44 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2010-12-16 11:12:44 +0000
commitc5d0998295a15fe649da854b68334c767aad1049 (patch)
tree2db9fb8634642201b27afb13552ceca7034e2b01
parentc3a94b57c8a28a0b80b0675c2098b70378f5a371 (diff)
sysdeps-unix: use MSG_NOSIGNAL when sending creds
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. Signed-off-by: Will Thompson <will.thompson@collabora.co.uk>
-rw-r--r--dbus/dbus-sysdeps-unix.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 97a6a4a3..8688ca2a 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)