[PATCH v2 4/5] qemuPrepareNVRAM: Switch to VIR_AUTOCLOSE

Michal Privoznik posted 5 patches 3 years, 12 months ago
[PATCH v2 4/5] qemuPrepareNVRAM: Switch to VIR_AUTOCLOSE
Posted by Michal Privoznik 3 years, 12 months ago
Nothing inside the qemuPrepareNVRAM function relies on @srcFD
being closed early and nothing closes it early. It's okay then to
close it automatically when leaving the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_process.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 036d95924c..0ba9343b2a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4463,7 +4463,7 @@ qemuPrepareNVRAM(virQEMUDriver *driver,
 {
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
     int ret = -1;
-    int srcFD = -1;
+    VIR_AUTOCLOSE srcFD = -1;
     virDomainLoaderDef *loader = vm->def->os.loader;
     const char *master_nvram_path;
     struct qemuPrepareNVRAMHelperData data;
@@ -4511,7 +4511,6 @@ qemuPrepareNVRAM(virQEMUDriver *driver,
 
     ret = 0;
  cleanup:
-    VIR_FORCE_CLOSE(srcFD);
     return ret;
 }
 
-- 
2.34.1

Re: [PATCH v2 4/5] qemuPrepareNVRAM: Switch to VIR_AUTOCLOSE
Posted by Daniel P. Berrangé 3 years, 12 months ago
On Fri, Feb 11, 2022 at 01:30:28PM +0100, Michal Privoznik wrote:
> Nothing inside the qemuPrepareNVRAM function relies on @srcFD
> being closed early and nothing closes it early. It's okay then to
> close it automatically when leaving the function.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_process.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|