loop write in qemu_event_increment upon EINTR

Same as what qemu-kvm does.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Paolo Bonzini 2010-02-02 20:33:10 +01:00 committed by Anthony Liguori
parent 1d0f0d91f2
commit 652ce2d449

6
vl.c
View File

@ -3217,8 +3217,12 @@ static void qemu_event_increment(void)
if (io_thread_fd == -1)
return;
do {
ret = write(io_thread_fd, &byte, sizeof(byte));
if (ret < 0 && (errno != EINTR && errno != EAGAIN)) {
} 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);