提交 9eb5c94e 编写于 作者: P Patrick Caulfield 提交者: David S. Miller

[DECNET]: fix SIGPIPE

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: NPatrick Caulfield <patrick@tykepenguin.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 388f7ef7
......@@ -1664,17 +1664,15 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
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, struct socket *sock,
if (sk->sk_shutdown & SEND_SHUTDOWN) {
err = -EPIPE;
if (!(flags & MSG_NOSIGNAL))
send_sig(SIGPIPE, current, 0);
goto out_err;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册