From 687068951ed1f3798e68f1ae250689e46b0e6cbd Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 26 Oct 2003 08:28:16 -0800 Subject: [PATCH] Revert signal handling changes in tcp.c - they break SIGURG. Cset exclude: kuznet@ms2.inr.ac.ru|ChangeSet|20031021052951|52463 --- net/ipv4/tcp.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 1da4fa8de3559..6f3331d6b9f1c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1540,6 +1540,17 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, if (copied && tp->urg_data && tp->urg_seq == *seq) break; + /* We need to check signals first, to get correct SIGURG + * handling. FIXME: Need to check this doesn't impact 1003.1g + * and move it down to the bottom of the loop + */ + if (signal_pending(current)) { + if (copied) + break; + copied = timeo ? sock_intr_errno(timeo) : -EAGAIN; + break; + } + /* Next get a buffer. */ skb = skb_peek(&sk->sk_receive_queue); @@ -1576,7 +1587,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN) || !timeo || - signal_pending(current) || (flags & MSG_PEEK)) break; } else { @@ -1606,11 +1616,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, copied = -EAGAIN; break; } - - if (signal_pending(current)) { - copied = sock_intr_errno(timeo); - break; - } } cleanup_rbuf(sk, copied); -- 2.53.0