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