mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 18:03:32 +00:00
qemuDomainSaveImageStartVM: Use VIR_AUTOCLOSE for @intermediatefd
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
0f814c0fed
commit
1c16f261d0
@ -6803,7 +6803,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
bool restored = false;
|
bool restored = false;
|
||||||
virObjectEventPtr event;
|
virObjectEventPtr event;
|
||||||
int intermediatefd = -1;
|
VIR_AUTOCLOSE intermediatefd = -1;
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
g_autofree char *errbuf = NULL;
|
g_autofree char *errbuf = NULL;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
@ -6829,6 +6829,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
|||||||
|
|
||||||
if (virCommandRunAsync(cmd, NULL) < 0) {
|
if (virCommandRunAsync(cmd, NULL) < 0) {
|
||||||
*fd = intermediatefd;
|
*fd = intermediatefd;
|
||||||
|
intermediatefd = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6872,8 +6873,6 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
|||||||
|
|
||||||
virErrorRestore(&orig_err);
|
virErrorRestore(&orig_err);
|
||||||
}
|
}
|
||||||
VIR_FORCE_CLOSE(intermediatefd);
|
|
||||||
|
|
||||||
if (VIR_CLOSE(*fd) < 0) {
|
if (VIR_CLOSE(*fd) < 0) {
|
||||||
virReportSystemError(errno, _("cannot close file: %s"), path);
|
virReportSystemError(errno, _("cannot close file: %s"), path);
|
||||||
restored = false;
|
restored = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user