提交 e375fe34 编写于 作者: E Eduardo Habkost 提交者: Anthony Liguori

exec_close(): return -errno on errors (v2)

All qemu_fclose() callers were already changed to accept any negative
value as error, so we now can change it to return -errno.

When the process exits with a non-zero exit code, we return -EIO to as a
fake errno value.

Changes v1 -> v2:
 - Don't use "//" comments, to make checkpatch.pl happy
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 0e286705
......@@ -50,12 +50,9 @@ static int exec_close(MigrationState *s)
ret = qemu_fclose(s->opaque);
s->opaque = NULL;
s->fd = -1;
if (ret >= 0 &&
WIFEXITED(ret)
&& WEXITSTATUS(ret) == 0) {
ret = 0;
} else {
ret = -1;
if (ret >= 0 && !(WIFEXITED(ret) && WEXITSTATUS(ret) == 0)) {
/* close succeeded, but non-zero exit code: */
ret = -EIO; /* fake errno value */
}
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册