From: Paolo Bonzini Date: Tue, 2 Feb 2010 19:33:10 +0000 (+0100) Subject: loop write in qemu_event_increment upon EINTR X-Git-Tag: v0.13.0-rc0~1430 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=652ce2d449f47cdc4d94eb67f2377504c06957ad;p=thirdparty%2Fqemu.git loop write in qemu_event_increment upon EINTR Same as what qemu-kvm does. Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- diff --git a/vl.c b/vl.c index f98661f34e2..29f218987a4 100644 --- a/vl.c +++ b/vl.c @@ -3217,8 +3217,12 @@ static void qemu_event_increment(void) if (io_thread_fd == -1) return; - ret = write(io_thread_fd, &byte, sizeof(byte)); - if (ret < 0 && (errno != EINTR && errno != EAGAIN)) { + do { + ret = write(io_thread_fd, &byte, sizeof(byte)); + } while (ret < 0 && errno == EINTR); + + /* EAGAIN is fine, a read must be pending. */ + if (ret < 0 && errno != EAGAIN) { fprintf(stderr, "qemu_event_increment: write() filed: %s\n", strerror(errno)); exit (1);