[AF_UNIX]: Fix SIOCINQ for STREAM.
Linux Kernel Mailing List <[email protected]> Sun, 27 Feb 2005 19:33:05 +0000
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
ChangeSet 1.1558.1.1, 2005/02/27 11:33:05-08:00, [email protected] [AF_UNIX]: Fix SIOCINQ for STREAM. We should report the total bytes in the whole receive queue, not just the first packet, in these cases. Reported by Uwe Bonnes. Signed-off-by: David S. Miller <[email protected]> af_unix.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff -Nru a/net/unix/af_unix.c b/net/unix/af_unix.c --- a/net/unix/af_unix.c 2005-03-04 12:03:24 -08:00 +++ b/net/unix/af_unix.c 2005-03-04 12:03:24 -08:00 @@ -1686,8 +1686,13 @@ } spin_lock(&sk->receive_queue.lock); - if((skb=skb_peek(&sk->receive_queue))!=NULL) - amount=skb->len; + if (sk->type == SOCK_STREAM) { + skb_queue_walk(&sk->receive_queue, skb) + amount += skb->len; + } else { + if((skb=skb_peek(&sk->receive_queue))!=NULL) + amount=skb->len; + } spin_unlock(&sk->receive_queue.lock); err = put_user(amount, (int *)arg); break;