From nobody Fri Apr 26 23:30:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610086530; cv=none; d=zohomail.com; s=zohoarc; b=eii0rq4op/tg5bMyS10wYILIzB6BxzIVRJVuG/ao2qdxoJZiv97Zgtkxd/Jti/3kbjm/L6Y5i5Afc9EcL67UZoVQ0UDJ+47m1JJG6MML4EQvOShO+S7OnxZxQLfdK1qg64IQTZ0mDe1tVQMC6oImavTyprkYK19I+GI4rWcDnAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610086530; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=PSUsEpReakKWgN/auMAVVuxoLKrBk0Jxsb79ye28x+I=; b=POOC1gDWE7HPwTnsYrpvLBrjF3rGqXCpxcKwpFRMv/VxlaXD9HTx+JswvEn8IJqh8exzCeQPlwGPyXsTRAgEtr+lSQnO91hbDskiAEmsgFLjRMM6n6+PpvtBUR0v1v3PHiKKFisK2JsjK1Y5+q2FNAkeO+J4Hi0Knx/o9NuyprU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1610086529957735.0811260220269; Thu, 7 Jan 2021 22:15:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-pjMk0CZ5MNa5uuy0O4gDZQ-1; Fri, 08 Jan 2021 01:15:26 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 18786107ACE3; Fri, 8 Jan 2021 06:15:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A6816062F; Fri, 8 Jan 2021 06:15:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5D6B64A7C6; Fri, 8 Jan 2021 06:15:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1086F2bE021795 for ; Fri, 8 Jan 2021 01:15:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7278E114B31E; Fri, 8 Jan 2021 06:15:02 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E17E114B31C for ; Fri, 8 Jan 2021 06:14:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF32D185A794 for ; Fri, 8 Jan 2021 06:14:58 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.206]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-gip2iSdfMeSIjRdgDVM_UA-1; Fri, 08 Jan 2021 01:14:55 -0500 Received: from localhost (unknown [192.168.167.13]) by regular1.263xmail.com (Postfix) with ESMTP id 255271B08 for ; Fri, 8 Jan 2021 14:14:51 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P21660T139636691166976S1610086465734820_; Fri, 08 Jan 2021 14:14:49 +0800 (CST) X-MC-Unique: pjMk0CZ5MNa5uuy0O4gDZQ-1 X-MC-Unique: gip2iSdfMeSIjRdgDVM_UA-1 X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-IP-DOMAINF: 1 X-UNIQUE-TAG: <85eb1605844484415fa5fff7af5c6013> X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Yi Li To: libvir-list@redhat.com Subject: [PATCH] storageBackendCreatePloop: Refactor cleanup Date: Fri, 8 Jan 2021 14:14:22 +0800 Message-Id: <20210108061422.3141235-1-yili@winhong.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1086F2bE021795 X-loop: libvir-list@redhat.com Cc: Yi Li X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" get rid of the 'cleanup:' label and created variable. Signed-off-by: Yi Li Reviewed-by: J=C3=A1n Tomko --- 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_G= NUC_UNUSED, unsigned int flags) { int ret =3D -1; - bool created =3D false; g_autoptr(virCommand) cmd =3D NULL; g_autofree char *create_tool =3D NULL; =20 @@ -607,7 +606,7 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_G= NUC_UNUSED, 0)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("error creating directory for ploop volume")); - goto cleanup; + return -1; } cmd =3D virCommandNewArgList(create_tool, "init", "-s", NULL); virCommandAddArgFormat(cmd, "%lluM", VIR_DIV_UP(vol->target.capaci= ty, @@ -620,10 +619,8 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_= GNUC_UNUSED, cmd =3D virCommandNewArgList("cp", "-r", inputvol->target.path, vol->target.path, NULL); } - created =3D true; ret =3D virCommandRun(cmd, NULL); - cleanup: - if (ret < 0 && created) + if (ret < 0) virFileDeleteTree(vol->target.path); return ret; } --=20 2.25.3