提交 957f094f 编写于 作者: A Alex Gartrell 提交者: David S. Miller

tun: return proper error code from tun_do_read

Instead of -1 with EAGAIN, read on a O_NONBLOCK tun fd will return 0.  This
fixes this by properly returning the error code from __skb_recv_datagram.
Signed-off-by: NAlex Gartrell <agartrell@fb.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 87897931
......@@ -1380,7 +1380,7 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0,
&peeked, &off, &err);
if (!skb)
return 0;
return err;
ret = tun_put_user(tun, tfile, skb, to);
if (unlikely(ret < 0))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册