g_warning ("Error setting socket status flags: %s", socket_strerror (errsv));
}
#endif
+
+#ifdef SO_NOSIGPIPE
+ /* See note about SIGPIPE below. */
+ g_socket_set_option (socket, SOL_SOCKET, SO_NOSIGPIPE, TRUE, NULL);
+#endif
}
}
/* There is no portable, thread-safe way to avoid having the process
* be killed by SIGPIPE when calling send() or sendmsg(), so we are
* forced to simply ignore the signal process-wide.
+ *
+ * Even if we ignore it though, gdb will still stop if the app
+ * receives a SIGPIPE, which can be confusing and annoying. So when
+ * possible, we also use MSG_NOSIGNAL / SO_NOSIGPIPE elsewhere to
+ * prevent the signal from occurring at all.
*/
signal (SIGPIPE, SIG_IGN);
#endif
error);
}
-/* Although we ignore SIGPIPE, gdb will still stop if the app receives
- * one, which can be confusing and annoying. So if possible, we want
- * to suppress the signal entirely.
- */
+/* See the comment about SIGPIPE above. */
#ifdef MSG_NOSIGNAL
#define G_SOCKET_DEFAULT_SEND_FLAGS MSG_NOSIGNAL
#else