From: Paolo Bonzini Date: Tue, 2 Feb 2010 19:33:09 +0000 (+0100) Subject: do not loop on an incomplete io_thread_fd read X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1d0f0d91f298cbda1990edc92cf8ac306c474cdf;p=qemu.git do not loop on an incomplete io_thread_fd read No need to loop if less than a full buffer is read, the next read would return EAGAIN. Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- diff --git a/vl.c b/vl.c index b87044c53c..f98661f34e 100644 --- a/vl.c +++ b/vl.c @@ -3229,12 +3229,12 @@ static void qemu_event_read(void *opaque) { int fd = (unsigned long)opaque; ssize_t len; + char buffer[512]; /* Drain the notify pipe */ do { - char buffer[512]; len = read(fd, buffer, sizeof(buffer)); - } while ((len == -1 && errno == EINTR) || len > 0); + } while ((len == -1 && errno == EINTR) || len == sizeof(buffer)); } static int qemu_event_init(void)