diff mbox

[3/3] Return ENOTCONN when trying to recv() on an unconnected UNIX socket.

Message ID 1457004183-24933-3-git-send-email-ed@nuxi.nl
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Ed Schouten March 3, 2016, 11:23 a.m. UTC
Both POSIX and our manual pages state that if send() or recv() is called
on an unconnected socket, ENOTCONN should be returned. It looks like our
implementation of send() already does this, but recv() does not.

Reference:
http://pubs.opengroup.org/onlinepubs/009695399/functions/send.html

Signed-off-by: Ed Schouten <ed@nuxi.nl>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index d810815..824dd63 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2283,7 +2283,7 @@  static int unix_stream_read_generic(struct unix_stream_read_state *state)
 	unsigned int last_len;
 
 	if (unlikely(sk->sk_state != TCP_ESTABLISHED)) {
-		err = -EINVAL;
+		err = -ENOTCONN;
 		goto out;
 	}