patch-2.1.12 linux/net/netrom/af_netrom.c

Next file: linux/net/netrom/nr_in.c
Previous file: linux/net/ipv6/udp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.11/linux/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c
@@ -122,6 +122,7 @@
 			s->protinfo.nr->device = NULL;
 			s->state               = TCP_CLOSE;
 			s->err                 = ENETUNREACH;
+			s->shutdown           |= SEND_SHUTDOWN;
 			s->state_change(s);
 			s->dead                = 1;
 		}
@@ -322,6 +323,7 @@
 			sk->protinfo.nr->state = NR_STATE_0;
 			sk->state              = TCP_CLOSE;
 			sk->err                = ENETRESET;
+			sk->shutdown          |= SEND_SHUTDOWN;
 			if (!sk->dead)
 				sk->state_change(sk);
 			sk->dead               = 1;
@@ -728,6 +730,7 @@
 
 		case NR_STATE_0:
 			sk->state     = TCP_CLOSE;
+			sk->shutdown |= SEND_SHUTDOWN;
 			sk->state_change(sk);
 			sk->dead      = 1;
 			nr_destroy_socket(sk);
@@ -736,6 +739,7 @@
 		case NR_STATE_1:
 			sk->protinfo.nr->state = NR_STATE_0;
 			sk->state              = TCP_CLOSE;
+			sk->shutdown          |= SEND_SHUTDOWN;
 			sk->state_change(sk);
 			sk->dead               = 1;
 			nr_destroy_socket(sk);
@@ -745,6 +749,7 @@
 			nr_write_internal(sk, NR_DISCACK);
 			sk->protinfo.nr->state = NR_STATE_0;
 			sk->state              = TCP_CLOSE;
+			sk->shutdown           = SEND_SHUTDOWN;
 			sk->state_change(sk);
 			sk->dead               = 1;
 			nr_destroy_socket(sk);
@@ -759,6 +764,7 @@
 			sk->protinfo.nr->t4timer = 0;
 			sk->protinfo.nr->state   = NR_STATE_2;
 			sk->state                = TCP_CLOSE;
+			sk->shutdown            |= SEND_SHUTDOWN;
 			sk->state_change(sk);
 			sk->dead                 = 1;
 			sk->destroy              = 1;
@@ -1139,6 +1145,11 @@
 	if (sk->zapped)
 		return -EADDRNOTAVAIL;
 
+	if (sk->shutdown & SEND_SHUTDOWN) {
+		send_sig(SIGPIPE, current, 0);
+		return -EPIPE;
+	}
+
 	if (sk->protinfo.nr->device == NULL)
 		return -ENETUNREACH;
 		
@@ -1253,11 +1264,12 @@
 	}
 
 	copied = skb->len;
-	if(copied>size)
-	{
-		copied=size;
-		msg->msg_flags|=MSG_TRUNC;
+
+	if (copied > size) {
+		copied = size;
+		msg->msg_flags |= MSG_TRUNC;
 	}
+
 	skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
 	
 	if (sax != NULL) {

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