提交 f532bfa2 编写于 作者: E Eric Blake

qemu: avoid fd leak on core dump failure

* src/qemu/qemu_driver.c (doCoreDump): Guarantee fd is closed.
上级 2ceb35e1
......@@ -2525,10 +2525,11 @@ cleanup:
return ret;
}
static int doCoreDump(struct qemud_driver *driver,
virDomainObjPtr vm,
const char *path,
enum qemud_save_formats compress)
static int
doCoreDump(struct qemud_driver *driver,
virDomainObjPtr vm,
const char *path,
enum qemud_save_formats compress)
{
int fd = -1;
int ret = -1;
......@@ -2554,6 +2555,7 @@ static int doCoreDump(struct qemud_driver *driver,
ret = 0;
cleanup:
VIR_FORCE_CLOSE(fd);
if (ret != 0)
unlink(path);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册