summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2009-06-08 18:40:04 +0300
committerEduardo Habkost <ehabkost@redhat.com>2009-06-08 13:31:02 -0300
commit2722bb7d2217995ffc1ee0666a9a78ac4c5e1c3e (patch)
treec42ab26876d10b9b8e93d82ef3b4949b4415c3d8
parentead65ad4117b15a5f79c13063fd2fa0b01e35c5d (diff)
exec-migration: handle EINTR in popen_get_buffer() (v3)
Sometimes, upon interrupt, fread returns with no data, and the (incoming exec) migration fails. Fix by retrying on such a case. Changes from v2: using clearerr and ferror using a local variable fp bz 501693 Signed-off-by: Uri Lublin <uril@redhat.com> Message-Id: <1244475604-25852-1-git-send-email-uril@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Upstream-status: pending Obsoletes: <1243956781-29993-5-git-send-email-uril@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Gleb Natapov <gleb@redhat.com> Bugzilla: 504237
-rw-r--r--qemu/savevm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/qemu/savevm.c b/qemu/savevm.c
index bc2652a9..f3b97075 100644
--- a/qemu/savevm.c
+++ b/qemu/savevm.c
@@ -211,7 +211,14 @@ static int popen_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int s
static int popen_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
{
QEMUFilePopen *s = opaque;
- return fread(buf, 1, size, s->popen_file);
+ FILE *fp = s->popen_file;
+ int bytes;
+
+ do {
+ clearerr(fp);
+ bytes = fread(buf, 1, size, fp);
+ } while ((bytes == 0) && ferror(fp) && (errno == EINTR));
+ return bytes;
}
static int popen_close(void *opaque)