From: Yi Li Date: Fri, 8 Jan 2021 06:14:22 +0000 (+0800) Subject: storageBackendCreatePloop: Refactor cleanup X-Git-Tag: v7.0.0-rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b66f26c34271e0511c7f1656d48ddb1faa386fe9;p=thirdparty%2Flibvirt.git storageBackendCreatePloop: Refactor cleanup Get rid of the 'cleanup' label and 'created' variable. Signed-off-by: Yi Li Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- 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; }