aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-07-21 09:25:54 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2015-08-10 15:31:16 -0500
commit35a616edef026c08f34fe677a2de9600ef94eb74 (patch)
tree9f11e87303520e4e98160815d030771fc0f854c9
parent35c30d3efdfb7d06f978cdb711cb27bc280dcbe8 (diff)
qemu-char: handle EINTR for TCP character devices
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 9172f428afc1461b1d9b33ebca3a679b9adf7c3a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--qemu-char.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/qemu-char.c b/qemu-char.c
index a405d76c31..1074a788d1 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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
- ret = recvmsg(s->fd, &msg, flags);
+ 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