提交 8a67ec4d 编写于 作者: U Uri Lublin 提交者: Anthony Liguori

exec-migration: handle EINTR in popen_get_buffer()

Sometimes, upon interrupt, fread returns with no data, and
the (incoming exec) migration fails.

Fix by retrying on such a case.
Signed-off-by: NUri Lublin <uril@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 d084eab6
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册