patch-2.1.124 linux/net/core/datagram.c

Next file: linux/net/core/neighbour.c
Previous file: linux/kernel/sysctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.123/linux/net/core/datagram.c linux/net/core/datagram.c
@@ -103,6 +103,11 @@
 	int error;
 	struct sk_buff *skb;
 
+	/* Caller is allowed not to check sk->err before skb_recv_datagram() */
+	error = sock_error(sk);
+	if (error)
+		goto no_packet;
+
 restart:
 	while(skb_queue_empty(&sk->receive_queue))	/* No data */
 	{
@@ -216,11 +221,11 @@
 	mask = 0;
 
 	/* exceptional events? */
-	if (sk->err)
+	if (sk->err || !skb_queue_empty(&sk->error_queue))
 		mask |= POLLERR;
 	if (sk->shutdown & RCV_SHUTDOWN)
 		mask |= POLLHUP;
-	
+
 	/* readable? */
 	if (!skb_queue_empty(&sk->receive_queue))
 		mask |= POLLIN | POLLRDNORM;
@@ -237,6 +242,8 @@
 	/* writable? */
 	if (sock_writeable(sk))
 		mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
+	else
+		sk->socket->flags |= SO_NOSPACE;
 
 	return mask;
 }

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