patch-2.0.18 linux/net/unix/af_unix.c

Next file: linux/CREDITS
Previous file: linux/net/ipv4/tcp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.17/linux/net/unix/af_unix.c linux/net/unix/af_unix.c
@@ -863,6 +863,12 @@
 		return -EINVAL;
 	}
 		
+	if(sk->shutdown&SEND_SHUTDOWN)
+	{
+		send_sig(SIGPIPE,current,0);
+		return -EPIPE;
+	}
+	
 	if(sunaddr!=NULL)
 	{
 		if(sock->type==SOCK_STREAM)
@@ -973,10 +979,27 @@
 				sock->state=SS_UNCONNECTED;
 				sti();
 				kfree_skb(skb, FREE_WRITE);
+				/*
+				 *	Check with 1003.1g - what should
+				 *	datagram error
+				 */
+				if (!sent)
+					sent = -ECONNRESET;
+				return sent;
+			}
+			/*
+			 *	Stream sockets SIGPIPE
+			 */
+			if(sock->type==SOCK_STREAM && other->dead)
+			{
+				kfree_skb(skb, FREE_WRITE);
+				sti();
 				if(!sent)
-					return -ECONNRESET;
-				else
-					return sent;
+				{
+					send_sig(SIGPIPE,current,0);
+					sent = -EPIPE;
+				}
+				return sent;
 			}
 		}
 		else


FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov