From nobody Wed May 8 11:57:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636734167; cv=none; d=zohomail.com; s=zohoarc; b=EuOn9ejoZ4OAPp/qUHrMxpCYEyYfWVjOgXKCPS08oS5sVTPkiIU4gUl9byVs6tQWIIfZ4KZeH63GPaS9UoJTmYosvORhSvdEczMN1nVZVUcUVuRWwuvREritBK0myg80s3EN0ai/Xw+zEn3XrZdpQIpC45aKpnRD/FLNFQmDVwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636734167; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=cBuhsLdxr0aozyu+6zjGEoNMa2h8K9ZrFiE++jthYgA=; b=PXx+g5iy/Z4GdGE8XbIdVLzHbV5ev4QnSN24GEzAfkTbOlQ9EH6WE5whMjKWp0of2eDknD08zTAuLqwcoqNbvd6afER3yk04HwNZJnS4hbJNhYpLMvPBjq7a3gpIN58ys0sHf50o5BIFUBkRevmYcsKUrvBEqAoPm/2WJRdKrpQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636734167540103.76786703823416; Fri, 12 Nov 2021 08:22:47 -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-154-YTdLHBJROQaIxdKpc00bjQ-1; Fri, 12 Nov 2021 11:22:44 -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 83AD618125D1; Fri, 12 Nov 2021 16:22:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3921E18A8F; Fri, 12 Nov 2021 16:22:39 +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 C0076181A1CF; Fri, 12 Nov 2021 16:22:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ACGMbVP020817 for ; Fri, 12 Nov 2021 11:22:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4EA8B60C4A; Fri, 12 Nov 2021 16:22:37 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CB3160C17 for ; Fri, 12 Nov 2021 16:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636734166; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cBuhsLdxr0aozyu+6zjGEoNMa2h8K9ZrFiE++jthYgA=; b=Zzu/qsh/zLdooNO2PGdDmS/MXzIGR8p17sb45BTKP4u+r/M0wXKeIHlnlLNvvfOSz/vAtS RJNUnhcfkNXEq0IZ6+LuR/Z8791PuVtOoacG4gzk/HKh9z3r13cjmnG3iaaUXmgdwUll9p oBh60PTCefaWQ5lMPcwW9jx+V6YXU50= X-MC-Unique: YTdLHBJROQaIxdKpc00bjQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] lib: Drop needless one line labels Date: Fri, 12 Nov 2021 17:22:34 +0100 Message-Id: <967c34f69626d458e83b26c4356a6dd58a7d5610.1636734140.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636734168482100001 Content-Type: text/plain; charset="utf-8" In some cases we have a label that contains nothing but a return statement. The amount of such labels rises as we use automagic cleanup. Anyway, such labels are pointless and can be dropped. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- examples/c/domain/dommigrate.c | 6 +- src/conf/domain_conf.c | 70 +++++++++----------- src/conf/netdev_vport_profile_conf.c | 33 +++++----- src/conf/storage_conf.c | 12 ++-- src/conf/storage_source_conf.c | 15 ++--- src/conf/virsavecookie.c | 3 +- src/hypervisor/virhostdev.c | 4 +- src/libxl/libxl_migration.c | 5 +- src/libxl/xen_xl.c | 9 +-- src/openvz/openvz_driver.c | 5 +- src/qemu/qemu_capabilities.c | 5 +- src/qemu/qemu_monitor_json.c | 16 ++--- src/qemu/qemu_snapshot.c | 21 +++--- src/qemu/qemu_virtiofs.c | 22 +++---- src/rpc/virnetlibsshsession.c | 10 +-- src/storage/storage_backend_iscsi.c | 13 ++-- src/test/test_driver.c | 5 +- src/util/vircgroup.c | 4 +- src/util/vircgroupv1.c | 24 +++---- src/util/virdnsmasq.c | 42 +++++------- src/util/virhostcpu.c | 11 ++-- tests/domainconftest.c | 5 +- tests/qemuxml2argvtest.c | 11 +--- tests/virpcitest.c | 15 ++--- tools/virsh-domain.c | 8 +-- tools/virsh-host.c | 6 +- tools/virsh-nodedev.c | 45 +++++-------- tools/virsh-volume.c | 96 +++++++++++----------------- 28 files changed, 199 insertions(+), 322 deletions(-) diff --git a/examples/c/domain/dommigrate.c b/examples/c/domain/dommigrate.c index 3d32ada6d3..07a947e869 100644 --- a/examples/c/domain/dommigrate.c +++ b/examples/c/domain/dommigrate.c @@ -42,7 +42,7 @@ main(int argc, char *argv[]) =20 if (argc < 4) { usage(argv[0]); - goto out; + return EXIT_FAILURE; } =20 src_uri =3D argv[1]; @@ -54,7 +54,7 @@ main(int argc, char *argv[]) if (!conn) { fprintf(stderr, "No connection to the source hypervisor: %s.\n", virGetLastErrorMessage()); - goto out; + return EXIT_FAILURE; } =20 printf("Attempting to retrieve domain %s...\n", domname); @@ -79,7 +79,5 @@ main(int argc, char *argv[]) if (dom !=3D NULL) virDomainFree(dom); virConnectClose(conn); - - out: return ret; } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index da0c64b460..54218e76e7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18859,7 +18859,7 @@ virDomainDefParseIDs(virDomainDef *def, /* Extract domain name */ if (!(def->name =3D virXPathString("string(./name[1])", ctxt))) { virReportError(VIR_ERR_NO_NAME, NULL); - goto error; + return -1; } =20 /* Extract domain uuid. If both uuid and sysinfo/system/entry/uuid @@ -18870,50 +18870,47 @@ virDomainDefParseIDs(virDomainDef *def, if (virUUIDGenerate(def->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to generate UUID")); - goto error; + return -1; } *uuid_generated =3D true; } else { if (virUUIDParse(tmp, def->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed uuid element")); - goto error; + return -1; } VIR_FREE(tmp); } =20 /* Extract domain genid - a genid can either be provided or generated = */ if ((n =3D virXPathNodeSet("./genid", ctxt, &nodes)) < 0) - goto error; + return -1; =20 if (n > 0) { if (n !=3D 1) { virReportError(VIR_ERR_XML_ERROR, "%s", _("element 'genid' can only appear once")); - goto error; + return -1; } def->genidRequested =3D true; if (!(tmp =3D virXPathString("string(./genid)", ctxt))) { if (virUUIDGenerate(def->genid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to generate genid")); - goto error; + return -1; } def->genidGenerated =3D true; } else { if (virUUIDParse(tmp, def->genid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed genid element")); - goto error; + return -1; } VIR_FREE(tmp); } } VIR_FREE(nodes); return 0; - - error: - return -1; } =20 =20 @@ -19002,20 +18999,20 @@ virDomainDefParseMemory(virDomainDef *def, /* Extract domain memory */ if (virDomainParseMemory("./memory[1]", NULL, ctxt, &def->mem.total_memory, false, true) < 0) - goto error; + return -1; =20 if (virDomainParseMemory("./currentMemory[1]", NULL, ctxt, &def->mem.cur_balloon, false, true) < 0) - goto error; + return -1; =20 if (virDomainParseMemory("./maxMemory[1]", NULL, ctxt, &def->mem.max_memory, false, false) < 0) - goto error; + return -1; =20 if (virXPathUInt("string(./maxMemory[1]/@slots)", ctxt, &def->mem.memo= ry_slots) =3D=3D -2) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Failed to parse memory slot count")); - goto error; + return -1; } =20 /* and info about it */ @@ -19023,7 +19020,7 @@ virDomainDefParseMemory(virDomainDef *def, (def->mem.dump_core =3D virTristateSwitchTypeFromString(tmp)) <=3D= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid memory core dump attribute value '%s'"),= tmp); - goto error; + return -1; } VIR_FREE(tmp); =20 @@ -19032,7 +19029,7 @@ virDomainDefParseMemory(virDomainDef *def, if ((def->mem.source =3D virDomainMemorySourceTypeFromString(tmp))= <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown memoryBacking/source/type '%s'"), tm= p); - goto error; + return -1; } VIR_FREE(tmp); } @@ -19042,7 +19039,7 @@ virDomainDefParseMemory(virDomainDef *def, if ((def->mem.access =3D virDomainMemoryAccessTypeFromString(tmp))= <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown memoryBacking/access/mode '%s'"), tm= p); - goto error; + return -1; } VIR_FREE(tmp); } @@ -19052,7 +19049,7 @@ virDomainDefParseMemory(virDomainDef *def, if ((def->mem.allocation =3D virDomainMemoryAllocationTypeFromStri= ng(tmp)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown memoryBacking/allocation/mode '%s'")= , tmp); - goto error; + return -1; } VIR_FREE(tmp); } @@ -19062,7 +19059,7 @@ virDomainDefParseMemory(virDomainDef *def, if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt,= &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot extract hugepages nodes")); - goto error; + return -1; } =20 if (n) { @@ -19071,7 +19068,7 @@ virDomainDefParseMemory(virDomainDef *def, for (i =3D 0; i < n; i++) { if (virDomainHugepagesParseXML(nodes[i], ctxt, &def->mem.hugepages[i]) < 0) - goto error; + return -1; def->mem.nhugepages++; } =20 @@ -19093,9 +19090,6 @@ virDomainDefParseMemory(virDomainDef *def, def->mem.discard =3D VIR_TRISTATE_BOOL_YES; =20 return 0; - - error: - return -1; } =20 =20 @@ -19446,43 +19440,40 @@ virDomainDefLifecycleParse(virDomainDef *def, &def->onReboot, VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, virDomainLifecycleActionTypeFromStrin= g) < 0) - goto error; + return -1; =20 if (virDomainEventActionParseXML(ctxt, "on_poweroff", "string(./on_poweroff[1])", &def->onPoweroff, VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, virDomainLifecycleActionTypeFromStrin= g) < 0) - goto error; + return -1; =20 if (virDomainEventActionParseXML(ctxt, "on_crash", "string(./on_crash[1])", &def->onCrash, VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, virDomainLifecycleActionTypeFromStrin= g) < 0) - goto error; + return -1; =20 if (virDomainEventActionParseXML(ctxt, "on_lockfailure", "string(./on_lockfailure[1])", &def->onLockFailure, VIR_DOMAIN_LOCK_FAILURE_DEFAULT, virDomainLockFailureTypeFromString) <= 0) - goto error; + return -1; =20 if (virDomainPMStateParseXML(ctxt, "string(./pm/suspend-to-mem/@enabled)", &def->pm.s3) < 0) - goto error; + return -1; =20 if (virDomainPMStateParseXML(ctxt, "string(./pm/suspend-to-disk/@enabled)", &def->pm.s4) < 0) - goto error; + return -1; =20 return 0; - - error: - return -1; } =20 =20 @@ -19499,7 +19490,7 @@ virDomainDefClockParse(virDomainDef *def, (def->clock.offset =3D virDomainClockOffsetTypeFromString(tmp)) < = 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown clock offset '%s'"), tmp); - goto error; + return -1; } VIR_FREE(tmp); =20 @@ -19516,7 +19507,7 @@ virDomainDefClockParse(virDomainDef *def, virReportError(VIR_ERR_XML_ERROR, _("unknown clock adjustment '%s'"), tmp); - goto error; + return -1; } switch (def->clock.offset) { case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: @@ -19546,7 +19537,7 @@ virDomainDefClockParse(virDomainDef *def, if ((def->clock.data.variable.basis =3D virDomainClockBasisTyp= eFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown clock basis '%s'"), tmp); - goto error; + return -1; } VIR_FREE(tmp); } else { @@ -19559,13 +19550,13 @@ virDomainDefClockParse(virDomainDef *def, if (!def->clock.data.timezone) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing 'timezone' attribute for clock with = offset=3D'timezone'")); - goto error; + return -1; } break; } =20 if ((n =3D virXPathNodeSet("./clock/timer", ctxt, &nodes)) < 0) - goto error; + return -1; =20 if (n) def->clock.timers =3D g_new0(virDomainTimerDef *, n); @@ -19574,16 +19565,13 @@ virDomainDefClockParse(virDomainDef *def, virDomainTimerDef *timer =3D virDomainTimerDefParseXML(nodes[i], c= txt); =20 if (!timer) - goto error; + return -1; =20 def->clock.timers[def->clock.ntimers++] =3D timer; } VIR_FREE(nodes); =20 return 0; - - error: - return -1; } =20 static int diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_p= rofile_conf.c index dfffc4dd70..d13833d7df 100644 --- a/src/conf/netdev_vport_profile_conf.c +++ b/src/conf/netdev_vport_profile_conf.c @@ -45,14 +45,14 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned in= t flags) (virtPort->virtPortType =3D virNetDevVPortTypeFromString(virtPortT= ype)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown virtualport type %s"), virtPortType); - goto error; + return NULL; } =20 if ((virtPort->virtPortType =3D=3D VIR_NETDEV_VPORT_PROFILE_NONE) && (flags & VIR_VPORT_XML_REQUIRE_TYPE)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing required virtualport type")); - goto error; + return NULL; } =20 while (cur !=3D NULL) { @@ -74,12 +74,12 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned in= t flags) if (virStrToLong_ui(virtPortManagerID, NULL, 0, &val)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse value of managerid parameter")); - goto error; + return NULL; } if (val > 0xff) { virReportError(VIR_ERR_XML_ERROR, "%s", _("value of managerid out of range")); - goto error; + return NULL; } virtPort->managerID =3D (uint8_t)val; virtPort->managerID_specified =3D true; @@ -91,12 +91,12 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned in= t flags) if (virStrToLong_ui(virtPortTypeID, NULL, 0, &val)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse value of typeid parameter")); - goto error; + return NULL; } if (val > 0xffffff) { virReportError(VIR_ERR_XML_ERROR, "%s", _("value for typeid out of range")); - goto error; + return NULL; } virtPort->typeID =3D (uint32_t)val; virtPort->typeID_specified =3D true; @@ -108,12 +108,12 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned = int flags) if (virStrToLong_ui(virtPortTypeIDVersion, NULL, 0, &val)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse value of typeidversion paramete= r")); - goto error; + return NULL; } if (val > 0xff) { virReportError(VIR_ERR_XML_ERROR, "%s", _("value of typeidversion out of range")); - goto error; + return NULL; } virtPort->typeIDVersion =3D (uint8_t)val; virtPort->typeIDVersion_specified =3D true; @@ -123,7 +123,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned in= t flags) if (virUUIDParse(virtPortInstanceID, virtPort->instanceID) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse instanceid parameter as a uuid"= )); - goto error; + return NULL; } virtPort->instanceID_specified =3D true; } @@ -132,14 +132,14 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned = int flags) virStrcpyStatic(virtPort->profileID, virtPortProfileID) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("profileid parameter too long")); - goto error; + return NULL; } =20 if (virtPortInterfaceID) { if (virUUIDParse(virtPortInterfaceID, virtPort->interfaceID) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse interfaceid parameter as a uuid= ")); - goto error; + return NULL; } virtPort->interfaceID_specified =3D true; } @@ -152,7 +152,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned in= t flags) if (virUUIDGenerate(virtPort->instanceID) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot generate a random uuid for instan= ceid")); - goto error; + return NULL; } virtPort->instanceID_specified =3D true; } @@ -162,7 +162,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned in= t flags) if (virUUIDGenerate(virtPort->interfaceID) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot generate a random uuid for interf= aceid")); - goto error; + return NULL; } virtPort->interfaceID_specified =3D true; } @@ -172,16 +172,13 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned = int flags) =20 if ((flags & VIR_VPORT_XML_REQUIRE_ALL_ATTRIBUTES) && (virNetDevVPortProfileCheckComplete(virtPort, false) < 0)) { - goto error; + return NULL; } =20 if (virNetDevVPortProfileCheckNoExtras(virtPort) < 0) - goto error; + return NULL; =20 return g_steal_pointer(&virtPort); - - error: - return NULL; } =20 =20 diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index c78456695c..6690d26ffd 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -692,7 +692,6 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, const char *permxpath) { long long val; - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr node; g_autofree char *mode =3D NULL; @@ -715,7 +714,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed octal mode")); - goto error; + return -1; } perms->mode =3D tmp; } else { @@ -731,7 +730,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, val !=3D -1)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed owner element")); - goto error; + return -1; } =20 perms->uid =3D val; @@ -746,17 +745,14 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, val !=3D -1)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed group element")); - goto error; + return -1; } perms->gid =3D val; } =20 /* NB, we're ignoring missing labels here - they'll simply inherit */ perms->label =3D virXPathString("string(./label)", ctxt); - - ret =3D 0; - error: - return ret; + return 0; } =20 =20 diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 5ca06fa30a..44944e1dbd 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -235,7 +235,6 @@ virStorageAuthDefParse(xmlNodePtr node, xmlXPathContextPtr ctxt) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - virStorageAuthDef *ret =3D NULL; xmlNodePtr secretnode =3D NULL; g_autoptr(virStorageAuthDef) authdef =3D NULL; g_autofree char *authtype =3D NULL; @@ -247,7 +246,7 @@ virStorageAuthDefParse(xmlNodePtr node, if (!(authdef->username =3D virXPathString("string(./@username)", ctxt= ))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing username for auth")); - goto cleanup; + return NULL; } =20 authdef->authType =3D VIR_STORAGE_AUTH_TYPE_NONE; @@ -259,14 +258,14 @@ virStorageAuthDefParse(xmlNodePtr node, if ((authdef->authType =3D virStorageAuthTypeFromString(authtype))= < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown auth type '%s'"), authtype); - goto cleanup; + return NULL; } } =20 if (!(secretnode =3D virXPathNode("./secret ", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing element in auth")); - goto cleanup; + return NULL; } =20 /* Used by the domain disk xml parsing in order to ensure the @@ -279,13 +278,9 @@ virStorageAuthDefParse(xmlNodePtr node, authdef->secrettype =3D virXMLPropString(secretnode, "type"); =20 if (virSecretLookupParseSecret(secretnode, &authdef->seclookupdef) < 0) - goto cleanup; + return NULL; =20 - ret =3D g_steal_pointer(&authdef); - - cleanup: - - return ret; + return g_steal_pointer(&authdef); } =20 =20 diff --git a/src/conf/virsavecookie.c b/src/conf/virsavecookie.c index c24a292355..5fc9ca06e1 100644 --- a/src/conf/virsavecookie.c +++ b/src/conf/virsavecookie.c @@ -61,9 +61,8 @@ virSaveCookieParse(xmlXPathContextPtr ctxt, =20 *obj =3D NULL; =20 - if (!(ctxt->node =3D virXPathNode("./cookie", ctxt))) { + if (!(ctxt->node =3D virXPathNode("./cookie", ctxt))) return 0; - } =20 return virSaveCookieParseNode(ctxt, obj, saveCookie); } diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 14ea560309..e44eb7f1d3 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -92,7 +92,7 @@ static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddr= ess *devAddr, void *opa if (helperData->usesVFIO && STREQ_NULLABLE(actual_drvname, helperData->driverName) && STREQ_NULLABLE(actual_domname, helperData->domainName)) - goto iommu_owner; + return 0; =20 if (actual_drvname && actual_domname) virReportError(VIR_ERR_OPERATION_INVALID, @@ -106,7 +106,7 @@ static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAd= dress *devAddr, void *opa virPCIDeviceGetName(actual)); return -1; } - iommu_owner: + return 0; } =20 diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index aa719a19d2..be5cc7e049 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -902,7 +902,7 @@ libxlMigrationSrcStartTunnel(libxlDriverPrivate *driver, tc->dataFD[0] =3D -1; tc->dataFD[1] =3D -1; if (virPipe(tc->dataFD) < 0) - goto out; + return -1; =20 arg =3D &tc->tmThread; /* Read from pipe */ @@ -915,7 +915,7 @@ libxlMigrationSrcStartTunnel(libxlDriverPrivate *driver, name, false, arg) < 0) { virReportError(errno, "%s", _("Unable to create tunnel migration thread")); - goto out; + return -1; } =20 virObjectUnlock(vm); @@ -923,7 +923,6 @@ libxlMigrationSrcStartTunnel(libxlDriverPrivate *driver, ret =3D libxlDoMigrateSrcSend(driver, vm, flags, tc->dataFD[1]); virObjectLock(vm); =20 - out: /* libxlMigrationSrcStopTunnel will be called in libxlDoMigrateSrcP2P * to free all resources for us. */ diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 05d4abbe81..17c5184b9b 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1607,7 +1607,6 @@ xenFormatXLDisk(virConfValue *list, virDomainDiskDef = *disk) int format =3D virDomainDiskGetFormat(disk); const char *driver =3D virDomainDiskGetDriver(disk); g_autofree char *target =3D NULL; - int ret =3D -1; =20 /* format */ virBufferAddLit(&buf, "format=3D"); @@ -1646,7 +1645,7 @@ xenFormatXLDisk(virConfValue *list, virDomainDiskDef = *disk) if (disk->transient) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("transient disks not supported yet")); - goto cleanup; + return -1; } =20 /* backendtype */ @@ -1673,7 +1672,7 @@ xenFormatXLDisk(virConfValue *list, virDomainDiskDef = *disk) * it must come last. */ if (xenFormatXLDiskSrc(disk->src, &target) < 0) - goto cleanup; + return -1; =20 if (target) virBufferAsprintf(&buf, ",target=3D%s", target); @@ -1689,10 +1688,8 @@ xenFormatXLDisk(virConfValue *list, virDomainDiskDef= *disk) tmp->next =3D val; else list->list =3D val; - ret =3D 0; =20 - cleanup: - return ret; + return 0; } =20 =20 diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 93549e914a..681eb734ce 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -799,7 +799,7 @@ openvzDomainSetNetworkConfig(virConnectPtr conn, if (openvzDomainSetNetwork(conn, def->name, def->nets[i], &buf) < = 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not configure network")); - goto exit; + return -1; } } =20 @@ -817,9 +817,6 @@ openvzDomainSetNetworkConfig(virConnectPtr conn, } =20 return 0; - - exit: - return -1; } =20 =20 diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 67fae46a34..e87cda8c11 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5580,14 +5580,11 @@ virQEMUCapsCacheNew(const char *libDir, priv->kernelVersion =3D g_strdup_printf("%s %s", uts.release, uts.= version); =20 priv->cpuData =3D virCPUDataGetHost(); - - cleanup: return cache; =20 error: virObjectUnref(cache); - cache =3D NULL; - goto cleanup; + return NULL; } =20 =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9186d59ca2..731227b158 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2058,16 +2058,16 @@ qemuMonitorJSONGetMemoryStats(qemuMonitor *mon, } =20 if (!balloonpath) - goto cleanup; + return ret; =20 if (!(cmd =3D qemuMonitorJSONMakeCommand("qom-get", "s:path", balloonpath, "s:property", "guest-stats", NULL))) - goto cleanup; + return ret; =20 if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return ret; =20 if ((data =3D virJSONValueObjectGetObject(reply, "error"))) { const char *klass =3D virJSONValueObjectGetString(data, "class"); @@ -2077,18 +2077,18 @@ qemuMonitorJSONGetMemoryStats(qemuMonitor *mon, STREQ_NULLABLE(desc, "guest hasn't updated any stats yet")) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("the guest hasn't updated any stats yet")); - goto cleanup; + return ret; } } =20 if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT) < 0) - goto cleanup; + return ret; =20 data =3D virJSONValueObjectGetObject(reply, "return"); =20 if (!(statsdata =3D virJSONValueObjectGet(data, "stats"))) { VIR_DEBUG("data does not include 'stats'"); - goto cleanup; + return ret; } =20 GET_BALLOON_STATS(statsdata, "stat-swap-in", @@ -2114,9 +2114,7 @@ qemuMonitorJSONGetMemoryStats(qemuMonitor *mon, GET_BALLOON_STATS(statsdata, "stat-htlb-pgfail", VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, 1); =20 - ret =3D got; - cleanup: - return ret; + return got; } #undef GET_BALLOON_STATS =20 diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index d105eead27..bd58d500eb 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1577,12 +1577,12 @@ qemuSnapshotCreateXML(virDomainPtr domain, parse_flags |=3D VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE; =20 if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) - goto cleanup; + return NULL; =20 if (!vm->persistent && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot halt after transient domain snapshot")); - goto cleanup; + return NULL; } if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) || !virDomainObjIsActive(vm)) @@ -1593,7 +1593,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, =20 if (!(def =3D virDomainSnapshotDefParseString(xmlDesc, driver->xmlopt, priv->qemuCaps, NULL, pars= e_flags))) - goto cleanup; + return NULL; =20 /* reject snapshot names containing slashes or starting with dot as * snapshot definitions are saved in files named by the snapshot name = */ @@ -1603,7 +1603,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, _("invalid snapshot name '%s': " "name can't contain '/'"), def->parent.name); - goto cleanup; + return NULL; } =20 if (def->parent.name[0] =3D=3D '.') { @@ -1611,7 +1611,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, _("invalid snapshot name '%s': " "name can't start with '.'"), def->parent.name); - goto cleanup; + return NULL; } } =20 @@ -1622,7 +1622,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("live snapshot creation is supported only " "during full system snapshots")); - goto cleanup; + return NULL; } =20 /* allow snapshots only in certain states */ @@ -1640,7 +1640,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, if (!redefine) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid domain state= %s"), virDomainSnapshotStateTypeToString(state)); - goto cleanup; + return NULL; } break; =20 @@ -1648,7 +1648,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("qemu doesn't support taking snapshots of " "PMSUSPENDED guests")); - goto cleanup; + return NULL; =20 /* invalid states */ case VIR_DOMAIN_SNAPSHOT_NOSTATE: @@ -1656,7 +1656,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, case VIR_DOMAIN_SNAPSHOT_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid domain state %s"= ), virDomainSnapshotStateTypeToString(state)); - goto cleanup; + return NULL; } =20 /* We are going to modify the domain below. Internal snapshots would u= se @@ -1665,7 +1665,7 @@ qemuSnapshotCreateXML(virDomainPtr domain, * job mask appropriately. */ if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT, flag= s) < 0) - goto cleanup; + return NULL; =20 qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_NONE); =20 @@ -1801,7 +1801,6 @@ qemuSnapshotCreateXML(virDomainPtr domain, =20 qemuDomainObjEndAsyncJob(driver, vm); =20 - cleanup: return snapshot; } =20 diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 0c12c5ea22..1b853a5a59 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -182,7 +182,6 @@ qemuVirtioFSStart(virQEMUDriver *driver, pid_t pid =3D (pid_t) -1; VIR_AUTOCLOSE fd =3D -1; VIR_AUTOCLOSE logfd =3D -1; - int ret =3D -1; int rc; =20 if (!virFileExists(fs->src->path)) { @@ -193,12 +192,12 @@ qemuVirtioFSStart(virQEMUDriver *driver, } =20 if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) - goto cleanup; + goto error; =20 socket_path =3D qemuDomainGetVHostUserFSSocketPath(vm->privateData, fs= ); =20 if ((fd =3D qemuVirtioFSOpenChardev(driver, vm, socket_path)) < 0) - goto cleanup; + goto error; =20 logpath =3D qemuVirtioFSCreateLogFilename(cfg, vm->def, fs->info.alias= ); =20 @@ -206,7 +205,7 @@ qemuVirtioFSStart(virQEMUDriver *driver, g_autoptr(virLogManager) logManager =3D virLogManagerNew(driver->p= rivileged); =20 if (!logManager) - goto cleanup; + goto error; =20 if ((logfd =3D virLogManagerDomainOpenLogFile(logManager, "qemu", @@ -215,12 +214,12 @@ qemuVirtioFSStart(virQEMUDriver *driver, logpath, 0, NULL, NULL)) < 0) - goto cleanup; + goto error; } else { if ((logfd =3D open(logpath, O_WRONLY | O_CREAT | O_APPEND, S_IRUS= R | S_IWUSR)) < 0) { virReportSystemError(errno, _("failed to create logfile %s"), logpath); - goto cleanup; + goto error; } if (virSetCloseExec(logfd) < 0) { virReportSystemError(errno, _("failed to set close-on-exec fla= g on %s"), @@ -230,7 +229,7 @@ qemuVirtioFSStart(virQEMUDriver *driver, } =20 if (!(cmd =3D qemuVirtioFSBuildCommandLine(cfg, fs, &fd))) - goto cleanup; + goto error; =20 /* so far only running as root is supported */ virCommandSetUID(cmd, 0); @@ -243,7 +242,7 @@ qemuVirtioFSStart(virQEMUDriver *driver, virCommandDaemonize(cmd); =20 if (qemuExtDeviceLogCommand(driver, vm, cmd, "virtiofsd") < 0) - goto cleanup; + goto error; =20 rc =3D virCommandRun(cmd, NULL); =20 @@ -267,10 +266,7 @@ qemuVirtioFSStart(virQEMUDriver *driver, goto error; } =20 - ret =3D 0; - - cleanup: - return ret; + return 0; =20 error: if (pid !=3D -1) @@ -279,7 +275,7 @@ qemuVirtioFSStart(virQEMUDriver *driver, unlink(pidfile); if (socket_path) unlink(socket_path); - goto cleanup; + return -1; } =20 =20 diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index 22d54c99be..a3adc85728 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -453,7 +453,6 @@ virNetLibsshImportPrivkey(virNetLibsshSession *sess, virNetLibsshAuthMethod *priv, ssh_key *ret_key) { - int err; int ret; ssh_key key; =20 @@ -470,8 +469,7 @@ virNetLibsshImportPrivkey(virNetLibsshSession *sess, virReportError(VIR_ERR_AUTH_FAILED, _("error while reading private key '%s'"), priv->filename); - err =3D SSH_AUTH_ERROR; - goto error; + return SSH_AUTH_ERROR; } else if (ret =3D=3D SSH_ERROR) { if (virGetLastErrorCode() =3D=3D VIR_ERR_OK) { virReportError(VIR_ERR_AUTH_FAILED, @@ -479,15 +477,11 @@ virNetLibsshImportPrivkey(virNetLibsshSession *sess, "passphrase?"), priv->filename); } - err =3D SSH_AUTH_ERROR; - goto error; + return SSH_AUTH_ERROR; } =20 *ret_key =3D key; return SSH_AUTH_SUCCESS; - - error: - return err; } =20 =20 diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_back= end_iscsi.c index ed17ed11a6..eef1d91062 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -91,7 +91,6 @@ static int virStorageBackendISCSIGetHostNumber(const char *sysfs_path, uint32_t *host) { - int ret =3D -1; g_autoptr(DIR) sysdir =3D NULL; struct dirent *dirent =3D NULL; int direrr; @@ -101,17 +100,16 @@ virStorageBackendISCSIGetHostNumber(const char *sysfs= _path, virWaitForDevices(); =20 if (virDirOpen(&sysdir, sysfs_path) < 0) - goto cleanup; + return -1; =20 while ((direrr =3D virDirRead(sysdir, &dirent, sysfs_path)) > 0) { if (STRPREFIX(dirent->d_name, "target")) { if (sscanf(dirent->d_name, "target%u:", host) =3D=3D 1) { - ret =3D 0; - goto cleanup; + return 0; } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to parse target '%s'"), dirent->d= _name); - goto cleanup; + return -1; } } } @@ -120,11 +118,10 @@ virStorageBackendISCSIGetHostNumber(const char *sysfs= _path, virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to get host number for iSCSI session " "with path '%s'"), sysfs_path); - goto cleanup; + return -1; } =20 - cleanup: - return ret; + return -1; } =20 static int diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ea474d55ac..d2577b2b16 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -858,13 +858,13 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *= file, const char *type) absFile =3D testBuildFilename(file, relFile); =20 if (!(doc =3D virXMLParse(absFile, NULL, type, NULL, false))) - goto error; + return NULL; =20 ret =3D xmlCopyNode(xmlDocGetRootElement(doc), 1); if (!ret) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to copy XML node")); - goto error; + return NULL; } xmlReplaceNode(node, ret); xmlFreeNode(node); @@ -872,7 +872,6 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *fi= le, const char *type) ret =3D node; } =20 - error: return ret; } =20 diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 6234095827..51da6e6a2f 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2764,8 +2764,7 @@ virCgroupKillRecursiveInternal(virCgroup *group, =20 if (rc =3D=3D 0) { VIR_DEBUG("Path %s does not exist, assuming done", keypath); - killedAny =3D false; - goto done; + return 0; } =20 while ((direrr =3D virDirRead(dp, &ent, keypath)) > 0) { @@ -2791,7 +2790,6 @@ virCgroupKillRecursiveInternal(virCgroup *group, if (direrr < 0) return -1; =20 - done: return killedAny ? 1 : 0; } =20 diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 8a04bb2e4a..96f36c3b4d 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -926,7 +926,6 @@ virCgroupV1SetOwner(virCgroup *cgroup, gid_t gid, int controllers) { - int ret =3D -1; size_t i; int direrr; =20 @@ -945,7 +944,7 @@ virCgroupV1SetOwner(virCgroup *cgroup, cgroup->legacy[i].placement); =20 if (virDirOpen(&dh, base) < 0) - goto cleanup; + return -1; =20 while ((direrr =3D virDirRead(dh, &de, base)) > 0) { g_autofree char *entry =3D NULL; @@ -956,24 +955,21 @@ virCgroupV1SetOwner(virCgroup *cgroup, virReportSystemError(errno, _("cannot chown '%s' to (%u, %u)"), entry, uid, gid); - goto cleanup; + return -1; } } if (direrr < 0) - goto cleanup; + return -1; =20 if (chown(base, uid, gid) < 0) { virReportSystemError(errno, _("cannot chown '%s' to (%u, %u)"), base, uid, gid); - goto cleanup; + return -1; } } =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 =20 @@ -1599,7 +1595,6 @@ virCgroupV1GetMemoryStat(virCgroup *group, unsigned long long *inactiveFile, unsigned long long *unevictable) { - int ret =3D -1; g_autofree char *stat =3D NULL; char *line =3D NULL; unsigned long long cacheVal =3D 0; @@ -1629,12 +1624,12 @@ virCgroupV1GetMemoryStat(virCgroup *group, if (!valueStr) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot parse 'memory.stat' cgroup file.")); - goto cleanup; + return -1; } *valueStr =3D '\0'; =20 if (virStrToLong_ull(valueStr + 1, NULL, 10, &value) < 0) - goto cleanup; + return -1; =20 if (STREQ(line, "cache")) cacheVal =3D value >> 10; @@ -1662,10 +1657,7 @@ virCgroupV1GetMemoryStat(virCgroup *group, *inactiveFile =3D inactiveFileVal; *unevictable =3D unevictableVal; =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 =20 diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index f2f606913f..2dd9a20377 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -172,10 +172,8 @@ addnhostsWrite(const char *path, =20 if (!(f =3D fopen(tmp, "w"))) { istmp =3D false; - if (!(f =3D fopen(path, "w"))) { - rc =3D -errno; - goto cleanup; - } + if (!(f =3D fopen(path, "w"))) + return -errno; } =20 for (i =3D 0; i < nhosts; i++) { @@ -186,7 +184,7 @@ addnhostsWrite(const char *path, if (istmp) unlink(tmp); =20 - goto cleanup; + return rc; } =20 for (j =3D 0; j < hosts[i].nhostnames; j++) { @@ -197,7 +195,7 @@ addnhostsWrite(const char *path, if (istmp) unlink(tmp); =20 - goto cleanup; + return rc; } } =20 @@ -208,23 +206,20 @@ addnhostsWrite(const char *path, if (istmp) unlink(tmp); =20 - goto cleanup; + return rc; } } =20 - if (VIR_FCLOSE(f) =3D=3D EOF) { - rc =3D -errno; - goto cleanup; - } + if (VIR_FCLOSE(f) =3D=3D EOF) + return -errno; =20 if (istmp && rename(tmp, path) < 0) { rc =3D -errno; unlink(tmp); - goto cleanup; + return rc; } =20 - cleanup: - return rc; + return 0; } =20 static int @@ -369,10 +364,8 @@ hostsfileWrite(const char *path, =20 if (!(f =3D fopen(tmp, "w"))) { istmp =3D false; - if (!(f =3D fopen(path, "w"))) { - rc =3D -errno; - goto cleanup; - } + if (!(f =3D fopen(path, "w"))) + return -errno; } =20 for (i =3D 0; i < nhosts; i++) { @@ -383,23 +376,20 @@ hostsfileWrite(const char *path, if (istmp) unlink(tmp); =20 - goto cleanup; + return rc; } } =20 - if (VIR_FCLOSE(f) =3D=3D EOF) { - rc =3D -errno; - goto cleanup; - } + if (VIR_FCLOSE(f) =3D=3D EOF) + return -errno; =20 if (istmp && rename(tmp, path) < 0) { rc =3D -errno; unlink(tmp); - goto cleanup; + return rc; } =20 - cleanup: - return rc; + return 0; } =20 static int diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 3563a662d5..67b6910626 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -90,7 +90,7 @@ virHostCPUGetStatsFreeBSD(int cpuNum, g_autofree long *cpu_times =3D NULL; struct clockinfo clkinfo; size_t i, j, cpu_times_size, clkinfo_size; - int cpu_times_num, offset, hz, stathz, ret =3D -1; + int cpu_times_num, offset, hz, stathz; struct field_cpu_map { const char *field; int idx[CPUSTATES]; @@ -151,7 +151,7 @@ virHostCPUGetStatsFreeBSD(int cpuNum, virReportSystemError(errno, _("sysctl failed for '%s'"), sysctl_name); - goto cleanup; + return -1; } =20 for (i =3D 0; cpu_map[i].field !=3D NULL; i++) { @@ -161,7 +161,7 @@ virHostCPUGetStatsFreeBSD(int cpuNum, virReportError(VIR_ERR_INTERNAL_ERROR, _("Field '%s' too long for destination"), cpu_map[i].field); - goto cleanup; + return -1; } =20 param->value =3D 0; @@ -169,10 +169,7 @@ virHostCPUGetStatsFreeBSD(int cpuNum, param->value +=3D cpu_times[offset + cpu_map[i].idx[j]] * TICK= _TO_NSEC; } =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 #endif /* __FreeBSD__ */ diff --git a/tests/domainconftest.c b/tests/domainconftest.c index 71fd1f7b73..14d84b0071 100644 --- a/tests/domainconftest.c +++ b/tests/domainconftest.c @@ -76,10 +76,10 @@ mymain(void) int ret =3D 0; =20 if ((caps =3D virTestGenericCapsInit()) =3D=3D NULL) - goto cleanup; + return EXIT_FAILURE; =20 if (!(xmlopt =3D virTestGenericDomainXMLConfInit())) - goto cleanup; + return EXIT_FAILURE; =20 #define DO_TEST_GET_FS(fspath, expect) \ do { \ @@ -100,7 +100,6 @@ mymain(void) virObjectUnref(caps); virObjectUnref(xmlopt); =20 - cleanup: return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 161e7efa62..58f16ef459 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -141,20 +141,15 @@ fakeStorageVolLookupByName(virStoragePoolPtr pool, return NULL; } =20 - if (!strchr(name, '+')) - goto fallback; - if (!(volinfo =3D g_strsplit(name, "+", 2))) return NULL; =20 - if (!volinfo[1]) - goto fallback; + if (!volinfo[1]) { + return virGetStorageVol(pool->conn, pool->name, name, "block", NUL= L, NULL); + } =20 return virGetStorageVol(pool->conn, pool->name, volinfo[1], volinfo[0], NULL, NULL); - - fallback: - return virGetStorageVol(pool->conn, pool->name, name, "block", NULL, N= ULL); } =20 static int diff --git a/tests/virpcitest.c b/tests/virpcitest.c index 4c0f0b91c3..ad2fcc6751 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -81,7 +81,7 @@ testVirPCIDeviceNew(const void *opaque G_GNUC_UNUSED) virReportError(VIR_ERR_INTERNAL_ERROR, \ "Unexpected count of items in " #list ": %d, " \ "expecting %zu", count, (size_t) cnt); \ - goto cleanup; \ + return -1; \ } =20 static int @@ -165,7 +165,6 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED) static int testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED) { - int ret =3D -1; virPCIDevice *dev[] =3D {NULL, NULL, NULL}; size_t i, nDev =3D G_N_ELEMENTS(dev); g_autoptr(virPCIDeviceList) activeDevs =3D NULL; @@ -174,17 +173,17 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UN= USED) =20 if (!(activeDevs =3D virPCIDeviceListNew()) || !(inactiveDevs =3D virPCIDeviceListNew())) - goto cleanup; + return -1; =20 for (i =3D 0; i < nDev; i++) { virPCIDeviceAddress devAddr =3D {.domain =3D 0, .bus =3D 0, .slot =3D i + 1, .function =3D 0}; if (!(dev[i] =3D virPCIDeviceNew(&devAddr))) - goto cleanup; + return -1; =20 if (virPCIDeviceListAdd(inactiveDevs, dev[i]) < 0) { virPCIDeviceFree(dev[i]); - goto cleanup; + return -1; } =20 CHECK_LIST_COUNT(activeDevs, 0); @@ -198,15 +197,13 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UN= USED) =20 for (i =3D 0; i < nDev; i++) { if (virPCIDeviceReattach(dev[i], activeDevs, inactiveDevs) < 0) - goto cleanup; + return -1; =20 CHECK_LIST_COUNT(activeDevs, 0); CHECK_LIST_COUNT(inactiveDevs, nDev - i - 1); } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 struct testPCIDevData { diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 22f428f702..c592d0281a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4453,7 +4453,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd) return false; =20 if (vshCommandOptStringReq(ctl, cmd, "file", &to) < 0) - goto cleanup; + return false; =20 if (vshCommandOptBool(cmd, "verbose")) verbose =3D true; @@ -4462,7 +4462,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd) true, doSave, &data) < 0) - goto cleanup; + return false; =20 virshWatchJob(ctl, dom, verbose, eventLoop, &data.ret, 0, NULL, NULL, _("Save")); @@ -4472,7 +4472,6 @@ cmdSave(vshControl *ctl, const vshCmd *cmd) if (!data.ret) vshPrintExtra(ctl, _("\nDomain '%s' saved to %s\n"), name, to); =20 - cleanup: return !data.ret; } =20 @@ -4770,7 +4769,7 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd) true, doManagedsave, &data) < 0) - goto cleanup; + return false; =20 virshWatchJob(ctl, dom, verbose, eventLoop, &data.ret, 0, NULL, NULL, _("Managedsave")); @@ -4780,7 +4779,6 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd) if (!data.ret) vshPrintExtra(ctl, _("\nDomain '%s' state saved by libvirt\n"), na= me); =20 - cleanup: return !data.ret; } =20 diff --git a/tools/virsh-host.c b/tools/virsh-host.c index fc84415e7b..5ae6657347 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1122,11 +1122,11 @@ vshExtractCPUDefXMLs(vshControl *ctl, } } =20 - cleanup: - return g_steal_pointer(&cpus); + return cpus; =20 error: - goto cleanup; + g_strfreev(cpus); + return NULL; } =20 =20 diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 424865962f..fe15d2d702 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -141,7 +141,6 @@ static bool cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshNodeDevice) dev =3D NULL; - bool ret =3D false; const char *device_value =3D NULL; =20 if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0) @@ -149,18 +148,16 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *c= md) =20 dev =3D vshFindNodeDevice(ctl, device_value); if (!dev) - goto cleanup; + return false; =20 if (virNodeDeviceDestroy(dev) =3D=3D 0) { vshPrintExtra(ctl, _("Destroyed node device '%s'\n"), device_value= ); } else { vshError(ctl, _("Failed to destroy node device '%s'"), device_valu= e); - goto cleanup; + return false; } =20 - ret =3D true; - cleanup: - return ret; + return true; } =20 struct virshNodeList { @@ -578,7 +575,6 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd) g_autoptr(virshNodeDevice) device =3D NULL; g_autofree char *xml =3D NULL; const char *device_value =3D NULL; - bool ret =3D false; =20 if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0) return false; @@ -586,16 +582,13 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *c= md) device =3D vshFindNodeDevice(ctl, device_value); =20 if (!device) - goto cleanup; + return false; =20 if (!(xml =3D virNodeDeviceGetXMLDesc(device, 0))) - goto cleanup; + return false; =20 vshPrint(ctl, "%s\n", xml); - - ret =3D true; - cleanup: - return ret; + return true; } =20 /* @@ -1013,7 +1006,6 @@ static bool cmdNodeDeviceUndefine(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) { g_autoptr(virshNodeDevice) dev =3D NULL; - bool ret =3D false; const char *device_value =3D NULL; =20 if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0) @@ -1022,17 +1014,15 @@ cmdNodeDeviceUndefine(vshControl *ctl, const vshCmd= *cmd G_GNUC_UNUSED) dev =3D vshFindNodeDevice(ctl, device_value); =20 if (!dev) - goto cleanup; + return false; =20 if (virNodeDeviceUndefine(dev, 0) < 0) { vshError(ctl, _("Failed to undefine node device '%s'"), device_val= ue); - goto cleanup; + return false; } =20 vshPrintExtra(ctl, _("Undefined node device '%s'\n"), device_value); - ret =3D true; - cleanup: - return ret; + return true; } =20 =20 @@ -1163,7 +1153,6 @@ static bool cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshNodeDevice) dev =3D NULL; - bool ret =3D false; const char *name =3D NULL; int autostart; =20 @@ -1172,7 +1161,8 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd = *cmd) =20 dev =3D vshFindNodeDevice(ctl, name); =20 - if (!dev) goto cleanup; + if (!dev) + return false; =20 autostart =3D !vshCommandOptBool(cmd, "disable"); =20 @@ -1181,7 +1171,7 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd = *cmd) vshError(ctl, _("failed to mark device %s as autostarted"), na= me); else vshError(ctl, _("failed to unmark device %s as autostarted"), = name); - goto cleanup; + return false; } =20 if (autostart) @@ -1189,9 +1179,7 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd = *cmd) else vshPrintExtra(ctl, _("Device %s unmarked as autostarted\n"), name); =20 - ret =3D true; - cleanup: - return ret; + return true; } =20 =20 @@ -1224,7 +1212,6 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshNodeDevice) device =3D NULL; const char *device_value =3D NULL; - bool ret =3D false; int autostart; const char *parent =3D NULL; =20 @@ -1234,7 +1221,7 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd) device =3D vshFindNodeDevice(ctl, device_value); =20 if (!device) - goto cleanup; + return false; =20 parent =3D virNodeDeviceGetParent(device); vshPrint(ctl, "%-15s %s\n", _("Name:"), virNodeDeviceGetName(device)); @@ -1248,9 +1235,7 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd) else vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") = : _("no")); =20 - ret =3D true; - cleanup: - return ret; + return true; } =20 =20 diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 12773d900b..ca40fbcd72 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -238,7 +238,6 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; unsigned long flags =3D 0; virshControl *priv =3D ctl->privData; - bool ret =3D false; =20 if (vshCommandOptBool(cmd, "prealloc-metadata")) flags |=3D VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA; @@ -247,27 +246,27 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) return false; =20 if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0) - goto cleanup; + return false; =20 if (vshCommandOptStringReq(ctl, cmd, "capacity", &capacityStr) < 0) - goto cleanup; + return false; =20 if (virshVolSize(capacityStr, &capacity) < 0) { vshError(ctl, _("Malformed size %s"), capacityStr); - goto cleanup; + return false; } =20 if (vshCommandOptStringQuiet(ctl, cmd, "allocation", &allocationStr) >= 0 && virshVolSize(allocationStr, &allocation) < 0) { vshError(ctl, _("Malformed size %s"), allocationStr); - goto cleanup; + return false; } =20 if (vshCommandOptStringReq(ctl, cmd, "format", &format) < 0 || vshCommandOptStringReq(ctl, cmd, "backing-vol", &snapshotStrVol) <= 0 || vshCommandOptStringReq(ctl, cmd, "backing-vol-format", &snapshotStrFormat) < 0) - goto cleanup; + return false; =20 virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); @@ -325,11 +324,11 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) } if (snapVol =3D=3D NULL) { vshError(ctl, _("failed to get vol '%s'"), snapshotStrVol); - goto cleanup; + return false; } =20 if ((snapshotStrVolPath =3D virStorageVolGetPath(snapVol)) =3D=3D = NULL) { - goto cleanup; + return false; } =20 /* Create XML for the backing store */ @@ -353,15 +352,12 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) } else { if (!(vol =3D virStorageVolCreateXML(pool, xml, flags))) { vshError(ctl, _("Failed to create vol %s"), name); - goto cleanup; + return false; } vshPrintExtra(ctl, _("Vol %s created\n"), name); } =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* @@ -393,7 +389,6 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd) g_autoptr(virshStoragePool) pool =3D NULL; g_autoptr(virshStorageVol) vol =3D NULL; const char *from =3D NULL; - bool ret =3D false; unsigned int flags =3D 0; g_autofree char *buffer =3D NULL; =20 @@ -404,23 +399,21 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd) return false; =20 if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) - goto cleanup; + return false; =20 if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) { vshSaveLibvirtError(); - goto cleanup; + return false; } =20 if (!(vol =3D virStorageVolCreateXML(pool, buffer, flags))) { vshError(ctl, _("Failed to create vol from %s"), from); - goto cleanup; + return false; } =20 vshPrintExtra(ctl, _("Vol %s created from %s\n"), virStorageVolGetName(vol), from); - ret =3D true; - cleanup: - return ret; + return true; } =20 /* @@ -463,12 +456,11 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd) g_autoptr(virshStorageVol) newvol =3D NULL; g_autoptr(virshStorageVol) inputvol =3D NULL; const char *from =3D NULL; - bool ret =3D false; g_autofree char *buffer =3D NULL; unsigned int flags =3D 0; =20 if (!(pool =3D virshCommandOptPool(ctl, cmd, "pool", NULL))) - goto cleanup; + return false; =20 if (vshCommandOptBool(cmd, "prealloc-metadata")) flags |=3D VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA; @@ -477,28 +469,26 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_STORAGE_VOL_CREATE_REFLINK; =20 if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) - goto cleanup; + return false; =20 if (!(inputvol =3D virshCommandOptVol(ctl, cmd, "vol", "inputpool", NU= LL))) - goto cleanup; + return false; =20 if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) { vshReportError(ctl); - goto cleanup; + return false; } =20 newvol =3D virStorageVolCreateXMLFrom(pool, buffer, inputvol, flags); =20 if (!newvol) { vshError(ctl, _("Failed to create vol from %s"), from); - goto cleanup; + return false; } =20 vshPrintExtra(ctl, _("Vol %s created from input vol %s\n"), virStorageVolGetName(newvol), virStorageVolGetName(input= vol)); - ret =3D true; - cleanup: - return ret; + return true; } =20 static xmlChar * @@ -653,7 +643,6 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) { const char *file =3D NULL; g_autoptr(virshStorageVol) vol =3D NULL; - bool ret =3D false; VIR_AUTOCLOSE fd =3D -1; g_autoptr(virshStream) st =3D NULL; const char *name =3D NULL; @@ -673,16 +662,16 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) return false; =20 if (vshCommandOptStringReq(ctl, cmd, "file", &file) < 0) - goto cleanup; + return false; =20 if ((fd =3D open(file, O_RDONLY)) < 0) { vshError(ctl, _("cannot read %s"), file); - goto cleanup; + return false; } =20 if (fstat(fd, &sb) < 0) { vshError(ctl, _("unable to stat %s"), file); - goto cleanup; + return false; } =20 cbData.ctl =3D ctl; @@ -694,12 +683,12 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) =20 if (!(st =3D virStreamNew(priv->conn, 0))) { vshError(ctl, _("cannot create a new stream")); - goto cleanup; + return false; } =20 if (virStorageVolUpload(vol, st, offset, length, flags) < 0) { vshError(ctl, _("cannot upload to volume %s"), name); - goto cleanup; + return false; } =20 if (flags & VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM) { @@ -707,30 +696,27 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) virshStreamInData, virshStreamSourceSkip, &cbData) < 0) { vshError(ctl, _("cannot send data to volume %s"), name); - goto cleanup; + return false; } } else { if (virStreamSendAll(st, virshStreamSource, &cbData) < 0) { vshError(ctl, _("cannot send data to volume %s"), name); - goto cleanup; + return false; } } =20 if (VIR_CLOSE(fd) < 0) { vshError(ctl, _("cannot close file %s"), file); virStreamAbort(st); - goto cleanup; + return false; } =20 if (virStreamFinish(st) < 0) { vshError(ctl, _("cannot close volume %s"), name); - goto cleanup; + return false; } =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* @@ -931,7 +917,6 @@ static bool cmdVolWipe(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshStorageVol) vol =3D NULL; - bool ret =3D false; const char *name; const char *algorithm_str =3D NULL; int algorithm =3D VIR_STORAGE_VOL_WIPE_ALG_ZERO; @@ -941,12 +926,12 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd) return false; =20 if (vshCommandOptStringReq(ctl, cmd, "algorithm", &algorithm_str) < 0) - goto out; + return false; =20 if (algorithm_str && (algorithm =3D virshStorageVolWipeAlgorithmTypeFromString(algorith= m_str)) < 0) { vshError(ctl, _("Unsupported algorithm '%s'"), algorithm_str); - goto out; + return false; } =20 if ((funcRet =3D virStorageVolWipePattern(vol, algorithm, 0)) < 0) { @@ -957,13 +942,11 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd) =20 if (funcRet < 0) { vshError(ctl, _("Failed to wipe vol %s"), name); - goto out; + return false; } =20 vshPrintExtra(ctl, _("Vol %s wiped\n"), name); - ret =3D true; - out: - return ret; + return true; } =20 =20 @@ -1111,7 +1094,6 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) const char *capacityStr =3D NULL; unsigned long long capacity =3D 0; unsigned int flags =3D 0; - bool ret =3D false; bool delta =3D vshCommandOptBool(cmd, "delta"); =20 if (vshCommandOptBool(cmd, "allocate")) @@ -1123,7 +1105,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) return false; =20 if (vshCommandOptStringReq(ctl, cmd, "capacity", &capacityStr) < 0) - goto cleanup; + return false; virSkipSpaces(&capacityStr); if (*capacityStr =3D=3D '-') { /* The API always requires a positive value; but we allow a @@ -1134,7 +1116,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) } else { vshError(ctl, "%s", _("negative size requires --shrink")); - goto cleanup; + return false; } } =20 @@ -1143,7 +1125,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) =20 if (virshVolSize(capacityStr, &capacity) < 0) { vshError(ctl, _("Malformed size %s"), capacityStr); - goto cleanup; + return false; } =20 if (virStorageVolResize(vol, capacity, flags) < 0) { @@ -1151,16 +1133,14 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) delta ? _("Failed to change size of volume '%s' by %s") : _("Failed to change size of volume '%s' to %s"), virStorageVolGetName(vol), capacityStr); - goto cleanup; + return false; } =20 vshPrintExtra(ctl, delta ? _("Size of volume '%s' successfully changed by %= s\n") : _("Size of volume '%s' successfully changed to %s\n"), virStorageVolGetName(vol), capacityStr); - ret =3D true; - cleanup: - return ret; + return true; } =20 /* --=20 2.32.0