[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [COMMIT 8a67ec4] exec-migration: handle EINTR in popen_ge
From: |
Anthony Liguori |
Subject: |
[Qemu-commits] [COMMIT 8a67ec4] exec-migration: handle EINTR in popen_get_buffer() |
Date: |
Mon, 15 Jun 2009 02:26:43 -0000 |
From: Uri Lublin <address@hidden>
Sometimes, upon interrupt, fread returns with no data, and
the (incoming exec) migration fails.
Fix by retrying on such a case.
Signed-off-by: Uri Lublin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
diff --git a/savevm.c b/savevm.c
index 61edd7e..17da35a 100644
--- a/savevm.c
+++ b/savevm.c
@@ -215,7 +215,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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [COMMIT 8a67ec4] exec-migration: handle EINTR in popen_get_buffer(),
Anthony Liguori <=