forked from rpms/libvirt
57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
From 6442aa5565de857371a7076c56ced84fbea0ec66 Mon Sep 17 00:00:00 2001
|
|
Message-Id: <6442aa5565de857371a7076c56ced84fbea0ec66@dist-git>
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Thu, 16 Jan 2020 10:03:51 +0100
|
|
Subject: [PATCH] qemuDomainSaveImageStartVM: Use VIR_AUTOCLOSE for
|
|
@intermediatefd
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
|
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1718707
|
|
|
|
(cherry picked from commit 1c16f261d0764ff70fb33ece4367f25e741cdb74)
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Message-Id: <f181efbc202853298ca06eecf78e7dad1063dc16.1579165329.git.mprivozn@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
---
|
|
src/qemu/qemu_driver.c | 5 ++---
|
|
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
index d6b1e9f00c..9de5bc6a32 100644
|
|
--- a/src/qemu/qemu_driver.c
|
|
+++ b/src/qemu/qemu_driver.c
|
|
@@ -6803,7 +6803,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
|
int ret = -1;
|
|
bool restored = false;
|
|
virObjectEventPtr event;
|
|
- int intermediatefd = -1;
|
|
+ VIR_AUTOCLOSE intermediatefd = -1;
|
|
virCommandPtr cmd = NULL;
|
|
g_autofree char *errbuf = NULL;
|
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
|
@@ -6829,6 +6829,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
|
|
|
if (virCommandRunAsync(cmd, NULL) < 0) {
|
|
*fd = intermediatefd;
|
|
+ intermediatefd = -1;
|
|
goto cleanup;
|
|
}
|
|
}
|
|
@@ -6872,8 +6873,6 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
|
|
|
virErrorRestore(&orig_err);
|
|
}
|
|
- VIR_FORCE_CLOSE(intermediatefd);
|
|
-
|
|
if (VIR_CLOSE(*fd) < 0) {
|
|
virReportSystemError(errno, _("cannot close file: %s"), path);
|
|
restored = false;
|
|
--
|
|
2.25.0
|
|
|