提交 1586a587 编写于 作者: E Eric Dumazet 提交者: David S. Miller

af_unix: do not report POLLOUT on listeners

poll(POLLOUT) on a listener should not report fd is ready for
a write().

This would break some applications using poll() and pfd.events = -1,
as they would not block in poll()
Signed-off-by: NEric Dumazet <edumazet@google.com>
Reported-by: NAlan Burlison <Alan.Burlison@oracle.com>
Tested-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 742e0383
......@@ -326,9 +326,10 @@ static struct sock *unix_find_socket_byinode(struct inode *i)
return s;
}
static inline int unix_writable(struct sock *sk)
static int unix_writable(const struct sock *sk)
{
return (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf;
return sk->sk_state != TCP_LISTEN &&
(atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf;
}
static void unix_write_space(struct sock *sk)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册