From c5d0998295a15fe649da854b68334c767aad1049 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Thu, 16 Dec 2010 11:11:44 +0000 Subject: 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 --- dbus/dbus-sysdeps-unix.c | 12 ++++++++++-- 1 file 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) -- cgit v1.2.3