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 <e...@nuxi.nl>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
        }
 
-- 
2.5.0

Reply via email to