[PATCH] storageBackendCreatePloop: Refactor cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



get rid of the 'cleanup:' label and created variable.

Signed-off-by: Yi Li <yili@xxxxxxxxxxx>
---
 src/storage/storage_util.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 2478cb0a4a..2e2c7dc68a 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -563,7 +563,6 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_GNUC_UNUSED,
                           unsigned int flags)
 {
     int ret = -1;
-    bool created = false;
     g_autoptr(virCommand) cmd = NULL;
     g_autofree char *create_tool = NULL;
 
@@ -607,7 +606,7 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_GNUC_UNUSED,
                           0)) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("error creating directory for ploop volume"));
-            goto cleanup;
+            return -1;
         }
         cmd = virCommandNewArgList(create_tool, "init", "-s", NULL);
         virCommandAddArgFormat(cmd, "%lluM", VIR_DIV_UP(vol->target.capacity,
@@ -620,10 +619,8 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_GNUC_UNUSED,
         cmd = virCommandNewArgList("cp", "-r", inputvol->target.path,
                                    vol->target.path, NULL);
     }
-    created = true;
     ret = virCommandRun(cmd, NULL);
- cleanup:
-    if (ret < 0 && created)
+    if (ret < 0)
         virFileDeleteTree(vol->target.path);
     return ret;
 }
-- 
2.25.3







[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux