All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DECnet fix SIGPIPE
@ 2005-11-11 13:35 Patrick Caulfield
  2005-11-11 20:04 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Caulfield @ 2005-11-11 13:35 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel

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.



Signed-off-by: Patrick Caulfield <patrick@tykepenguin.com>

diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -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;
 	}
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-11 20:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-11 13:35 [PATCH] DECnet fix SIGPIPE Patrick Caulfield
2005-11-11 20:04 ` David S. Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.