提交 9172f428 编写于 作者: P Paolo Bonzini

qemu-char: handle EINTR for TCP character devices

Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 0b8e2c10
......@@ -2797,7 +2797,10 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
#ifdef MSG_CMSG_CLOEXEC
flags |= MSG_CMSG_CLOEXEC;
#endif
do {
ret = recvmsg(s->fd, &msg, flags);
} while (ret == -1 && errno == EINTR);
if (ret > 0 && s->is_unix) {
unix_process_msgfd(chr, &msg);
}
......@@ -2808,7 +2811,13 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
{
TCPCharDriver *s = chr->opaque;
return qemu_recv(s->fd, buf, len, 0);
ssize_t ret;
do {
ret = qemu_recv(s->fd, buf, len, 0);
} while (ret == -1 && socket_error() == EINTR);
return ret;
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册