Skip to contentSkip to conversation

DECnet fix SIGPIPE

PATCH Applied Patrick Caulfield 2 participants 2 messages Nov 11, 2005 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DECnet fix SIGPIPE

This patch fixes SIGIPIPE for DECnet. Currently recvmsg generates SIGPIPE whereas sendmsg does not; for the other stacks it seems to be the other way round!

It also fixes the bug where reading from a socket whose peer has shutdown returned -EINVAL rather than 0.

net/decnet/af_decnet.c +7 -7
@@ -1664,17 +1664,15 @@ static int dn_recvmsg(struct kiocb *iocb
 		goto out;
 	}
 
-	rv = dn_check_state(sk, NULL, 0, &timeo, flags);
-	if (rv)
-		goto out;
-
 	if (sk->sk_shutdown & RCV_SHUTDOWN) {
-		if (!(flags & MSG_NOSIGNAL))
-			send_sig(SIGPIPE, current, 0);
-		rv = -EPIPE;
+		rv = 0;
 		goto out;
 	}
 
+	rv = dn_check_state(sk, NULL, 0, &timeo, flags);
+	if (rv)
+		goto out;
+
 	if (flags & ~(MSG_PEEK|MSG_OOB|MSG_WAITALL|MSG_DONTWAIT|MSG_NOSIGNAL)) {
 		rv = -EOPNOTSUPP;
 		goto out;
@@ -1928,6 +1926,8 @@ static int dn_sendmsg(struct kiocb *iocb
 
 	if (sk->sk_shutdown & SEND_SHUTDOWN) {
 		err = -EPIPE;
+		if (!(flags & MSG_NOSIGNAL))
+			send_sig(SIGPIPE, current, 0);
 		goto out_err;
 	}
 
maintainer Applied
#1 lore raw

From: Patrick Caulfield <[email protected]>
Date: Fri, 11 Nov 2005 13:35:47 +0000

Quoted 8 lines

This patch fixes SIGIPIPE for DECnet. Currently recvmsg generates SIGPIPE whereas sendmsg does not; for the other stacks it seems to be the other way round!

It also fixes the bug where reading from a socket whose peer has shutdown returned -EINVAL rather than 0.

Applied, thanks Patrick.