? docs/Makefile
? docs/Makefile.in
? mono/os/unix/.deps
Index: ChangeLog
===================================================================
RCS file: /mono/mono/ChangeLog,v
retrieving revision 1.98
diff -u -r1.98 ChangeLog
--- ChangeLog	30 May 2002 10:16:22 -0000	1.98
+++ ChangeLog	10 Jun 2002 18:12:20 -0000
@@ -1,3 +1,7 @@
+2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>
+
+	* configure.in: added checks for MSG_NOSIGNAL
+
 2002-05-30  Daniel Morgan <danmorg@sc.rr.com>
 
 	* doc/ado-net: update the ado-net web page on go-mono.com
Index: acconfig.h
===================================================================
RCS file: /mono/mono/acconfig.h,v
retrieving revision 1.16
diff -u -r1.16 acconfig.h
--- acconfig.h	30 Apr 2002 19:30:06 -0000	1.16
+++ acconfig.h	10 Jun 2002 18:12:20 -0000
@@ -1,5 +1,6 @@
 #undef HAVE_INET_PTON
 #undef HAVE_INET_ATON
+#undef HAVE_MSG_NOSIGNAL
 #undef HAVE_SOL_IP
 #undef HAVE_SOL_TCP
 #undef HAVE_IP_PKTINFO
Index: configure.in
===================================================================
RCS file: /mono/mono/configure.in,v
retrieving revision 1.80
diff -u -r1.80 configure.in
--- configure.in	18 May 2002 17:41:44 -0000	1.80
+++ configure.in	10 Jun 2002 18:12:21 -0000
@@ -183,6 +183,21 @@
 	dnl *****************************
 	AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
 
+	dnl *******************************
+	dnl *** Checks for MSG_NOSIGNAL ***
+	dnl *******************************
+	AC_MSG_CHECKING(for MSG_NOSIGNAL)
+	AC_TRY_COMPILE([#include <sys/socket.h>], [
+		int f = MSG_NOSIGNAL;
+	], [
+		# Yes, we have it...
+		AC_MSG_RESULT(yes)
+		AC_DEFINE(HAVE_MSG_NOSIGNAL)
+	], [
+		# We'll have to use signals
+		AC_MSG_RESULT(no)
+	])
+
 	dnl *****************************
 	dnl *** Checks for SOL_IP     ***
 	dnl *****************************
Index: mono/io-layer/ChangeLog
===================================================================
RCS file: /mono/mono/mono/io-layer/ChangeLog,v
retrieving revision 1.53
diff -u -r1.53 ChangeLog
--- mono/io-layer/ChangeLog	8 Jun 2002 17:57:49 -0000	1.53
+++ mono/io-layer/ChangeLog	10 Jun 2002 18:12:22 -0000
@@ -1,3 +1,8 @@
+2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>
+
+	* sockets.c: Prevent SIGPIPE from being raised when writing to
+	a closed socket.
+
 2002-06-08  Jeffrey Stedfast  <fejj@ximian.com>
 
 	* mono-mutex.c (mono_once): New convenience function for my
Index: mono/io-layer/sockets.c
===================================================================
RCS file: /mono/mono/mono/io-layer/sockets.c,v
retrieving revision 1.12
diff -u -r1.12 sockets.c
--- mono/io-layer/sockets.c	8 Jun 2002 17:57:49 -0000	1.12
+++ mono/io-layer/sockets.c	10 Jun 2002 18:12:22 -0000
@@ -23,6 +23,10 @@
 #endif
 #include <unistd.h>
 
+#ifndef HAVE_MSG_NOSIGNAL
+#include <signal.h>
+#endif
+
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
 #include <mono/io-layer/socket-private.h>
@@ -657,6 +661,9 @@
 int _wapi_recvfrom(guint32 handle, void *buf, size_t len, int recv_flags,
 		   struct sockaddr *from, socklen_t *fromlen)
 {
+#ifndef HAVE_MSG_NOSIGNAL
+	void (*old_sigpipe)(int);	// old SIGPIPE handler
+#endif
 	struct _WapiHandlePrivate_socket *socket_private_handle;
 	gboolean ok;
 	int ret;
@@ -675,8 +682,16 @@
 		return(SOCKET_ERROR);
 	}
 	
+#ifdef HAVE_MSG_NOSIGNAL
+	ret=recvfrom(socket_private_handle->fd, buf, len, recv_flags | MSG_NOSIGNAL, from,
+		     fromlen);
+#else
+	old_sigpipe = signal(SIGPIPE, SIG_IGN);
 	ret=recvfrom(socket_private_handle->fd, buf, len, recv_flags, from,
 		     fromlen);
+	signal(SIGPIPE, old_sigpipe);
+#endif
+
 	if(ret==-1) {
 #ifdef DEBUG
 		g_message(G_GNUC_PRETTY_FUNCTION ": recv error: %s",
@@ -719,6 +734,9 @@
 
 int _wapi_send(guint32 handle, const void *msg, size_t len, int send_flags)
 {
+#ifndef HAVE_MSG_NOSIGNAL
+	void (*old_sigpipe)(int);	// old SIGPIPE handler
+#endif
 	struct _WapiHandlePrivate_socket *socket_private_handle;
 	gboolean ok;
 	int ret;
@@ -736,8 +754,14 @@
 		WSASetLastError(WSAENOTSOCK);
 		return(SOCKET_ERROR);
 	}
-	
+
+#ifdef HAVE_MSG_NOSIGNAL
+	ret=send(socket_private_handle->fd, msg, len, send_flags | MSG_NOSIGNAL);
+#else
+	old_sigpipe = signal(SIGPIPE, SIG_IGN);
 	ret=send(socket_private_handle->fd, msg, len, send_flags);
+	signal(SIGPIPE, old_sigpipe);
+#endif
 	if(ret==-1) {
 #ifdef DEBUG
 		g_message(G_GNUC_PRETTY_FUNCTION ": send error: %s",
@@ -787,6 +811,9 @@
 int _wapi_sendto(guint32 handle, const void *msg, size_t len, int send_flags,
 		 const struct sockaddr *to, socklen_t tolen)
 {
+#ifndef HAVE_MSG_NOSIGNAL
+	void (*old_sigpipe)(int);	// old SIGPIPE handler
+#endif
 	struct _WapiHandlePrivate_socket *socket_private_handle;
 	gboolean ok;
 	int ret;
@@ -805,7 +832,13 @@
 		return(SOCKET_ERROR);
 	}
 	
+#ifdef HAVE_MSG_NOSIGNAL
+	ret=sendto(socket_private_handle->fd, msg, len, send_flags | MSG_NOSIGNAL, to, tolen);
+#else
+	old_sigpipe = signal(SIGPIPE, SIG_IGN);
 	ret=sendto(socket_private_handle->fd, msg, len, send_flags, to, tolen);
+	signal(SIGPIPE, old_sigpipe);
+#endif
 	if(ret==-1) {
 #ifdef DEBUG
 		g_message(G_GNUC_PRETTY_FUNCTION ": send error: %s",
