[libvirt] [PATCH v5 02/20] qemu: clean up qemuDomainRemoveInactiveCommon

Eric Blake posted 20 patches 6 years, 11 months ago
[libvirt] [PATCH v5 02/20] qemu: clean up qemuDomainRemoveInactiveCommon
Posted by Eric Blake 6 years, 11 months ago
Use VIR_AUTOFREE and saner formatting. No semantic change.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 src/qemu/qemu_domain.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 68298ad4e8..e243c07168 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8652,8 +8652,8 @@ static void
 qemuDomainRemoveInactiveCommon(virQEMUDriverPtr driver,
                                virDomainObjPtr vm)
 {
-    char *snapDir;
     virQEMUDriverConfigPtr cfg;
+    VIR_AUTOFREE(char *) snapDir = NULL;

     cfg = virQEMUDriverGetConfig(driver);

@@ -8661,15 +8661,12 @@ qemuDomainRemoveInactiveCommon(virQEMUDriverPtr driver,
     if (qemuDomainSnapshotDiscardAllMetadata(driver, vm) < 0) {
         VIR_WARN("unable to remove all snapshots for domain %s",
                  vm->def->name);
-    }
-    else if (virAsprintf(&snapDir, "%s/%s", cfg->snapshotDir,
-                         vm->def->name) < 0) {
+    } else if (virAsprintf(&snapDir, "%s/%s", cfg->snapshotDir,
+                           vm->def->name) < 0) {
         VIR_WARN("unable to remove snapshot directory %s/%s",
                  cfg->snapshotDir, vm->def->name);
-    } else {
-        if (rmdir(snapDir) < 0 && errno != ENOENT)
-            VIR_WARN("unable to remove snapshot directory %s", snapDir);
-        VIR_FREE(snapDir);
+    } else if (rmdir(snapDir) < 0 && errno != ENOENT) {
+        VIR_WARN("unable to remove snapshot directory %s", snapDir);
     }
     qemuExtDevicesCleanupHost(driver, vm->def);

-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v5 02/20] qemu: clean up qemuDomainRemoveInactiveCommon
Posted by John Ferlan 6 years, 11 months ago

On 3/7/19 12:47 AM, Eric Blake wrote:
> Use VIR_AUTOFREE and saner formatting. No semantic change.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

I think this can be pushed without the rest...

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v5 02/20] qemu: clean up qemuDomainRemoveInactiveCommon
Posted by Eric Blake 6 years, 11 months ago
On 3/12/19 12:59 PM, John Ferlan wrote:
> 
> 
> On 3/7/19 12:47 AM, Eric Blake wrote:
>> Use VIR_AUTOFREE and saner formatting. No semantic change.
>>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>> ---
>>  src/qemu/qemu_domain.c | 13 +++++--------
>>  1 file changed, 5 insertions(+), 8 deletions(-)
>>
> 
> Reviewed-by: John Ferlan <jferlan@redhat.com>
> 
> John
> 
> I think this can be pushed without the rest...

Agreed; 1 and 2 are now pushed.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list