From nobody Sun Feb 8 21:33:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1571752783; cv=none; d=zoho.com; s=zohoarc; b=UhjeeorRayejas31TyYfLHILTAxgWRlIhTSSRyYYOq79fGqwbFBop1UJwGcrz9inJ1PLYSpVnVPLUfxhf/JzqSpuQeYCwh7TOBqNfeH4EGV+5YbAOzagF/FvhMtiPRvhkUAJSUwhGx9YHR4PSVHUUXqONluTFR7MVneTGK9wPzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571752783; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Rfnqb0N5IJ2zErPvXE6aavh5getNk4kvDygaCh0RYwo=; b=LOpuDHHHbC6Fpj1vxHR7TxaZVbdrdMrIyGc4W9kNLBcCqTs0twTGvbGWrQ8MqemDkShwPCfRXoH5tcm2mbnjCD7RskMjCud5sMfCjYc4TsoN4fqwiAskyWy4xD1JH3CU3RsyRosYhqWIi+InwfIaELO4N//QiNIQHVBLmusuRvE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571752783374317.9718554358657; Tue, 22 Oct 2019 06:59:43 -0700 (PDT) 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-208-cCZKZMdnMjaPYJxUGRM46g-1; Tue, 22 Oct 2019 09:59:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE33D1005526; Tue, 22 Oct 2019 13:59:35 +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 96F7B5D6A9; Tue, 22 Oct 2019 13:59:35 +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 556D11803B50; Tue, 22 Oct 2019 13:59:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9MDxWiC002101 for ; Tue, 22 Oct 2019 09:59:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 48D056012E; Tue, 22 Oct 2019 13:59:32 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C55A0601AC for ; Tue, 22 Oct 2019 13:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571752782; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Rfnqb0N5IJ2zErPvXE6aavh5getNk4kvDygaCh0RYwo=; b=jOYoQrtRu6+uYFK8VBdaGGA7iXbBOA24csOtV7keLLv7GHfd0MbcVK4152sjL8kfd2U99p NUtIHvPDPNJKNm+ouesR+r9+IxynoGRVsM8TKjVz+fqivYpgXG/CMTEn0X5tLoPgpl8tca khQRBX3zo9pbIiQ1eo9gCMQVdDWd0RY= From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 22 Oct 2019 15:57:36 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 32/75] tools: Drop virAsprintf() and virAsprintfQuiet() retval checking 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.15 X-MC-Unique: cCZKZMdnMjaPYJxUGRM46g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" These functions can't fail really. Drop checking of their retval then. Signed-off-by: Michal Privoznik --- tools/virsh-completer-domain.c | 7 +++---- tools/virsh-completer-host.c | 13 +++++------- tools/virsh-completer.c | 6 +++--- tools/virsh-domain-monitor.c | 21 +++++++++---------- tools/virsh-domain.c | 34 ++++++++++--------------------- tools/virsh-host.c | 3 +-- tools/virsh-interface.c | 11 +++++----- tools/virsh-network.c | 3 +-- tools/virsh-pool.c | 15 ++++++-------- tools/virsh-volume.c | 9 +++------ tools/virt-admin.c | 6 ++---- tools/vsh.c | 37 +++++++++++----------------------- 12 files changed, 62 insertions(+), 103 deletions(-) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 6bfa3ab58c..0bf6202c0a 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -221,10 +221,9 @@ virshDomainInterfaceStateCompleter(vshControl *ctl, if (virMacAddrParse(iface, &macaddr) =3D=3D 0) virMacAddrFormat(&macaddr, macstr); =20 - if (virAsprintf(&xpath, "/domain/devices/interface[(mac/@address =3D '= %s') or " - " (target/@dev =3D '%= s')]", - macstr, iface) < 0) - return NULL; + virAsprintf(&xpath, "/domain/devices/interface[(mac/@address =3D '%s')= or " + " (target/@dev =3D '%s')]", macst= r, + iface); =20 if ((ninterfaces =3D virXPathNodeSet(xpath, ctxt, &interfaces)) < 0) return NULL; diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c index 42e59a6656..8cb98ad88d 100644 --- a/tools/virsh-completer-host.c +++ b/tools/virsh-completer-host.c @@ -44,8 +44,7 @@ virshPagesizeNodeToString(xmlNodePtr node) if (virScaleInteger(&byteval, unit, 1024, UINT_MAX) < 0) return NULL; size =3D vshPrettyCapacity(byteval, &suffix); - if (virAsprintf(&ret, "%.0f%s", size, suffix) < 0) - return NULL; + virAsprintf(&ret, "%.0f%s", size, suffix); return ret; } =20 @@ -79,13 +78,11 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl, return NULL; =20 if (cellno && vshCommandOptStringQuiet(ctl, cmd, "cellno", &cellnum) >= 0) { - if (virAsprintf(&path, - "/capabilities/host/topology/cells/cell[@id=3D\"%s= \"]/pages", - cellnum) < 0) - return NULL; + virAsprintf(&path, + "/capabilities/host/topology/cells/cell[@id=3D\"%s\"]/= pages", + cellnum); } else { - if (virAsprintf(&path, "/capabilities/host/cpu/pages") < 0) - return NULL; + virAsprintf(&path, "/capabilities/host/cpu/pages"); } =20 npages =3D virXPathNodeSet(path, ctxt, &pages); diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 7e4bd895e5..8bd7be888f 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -118,9 +118,9 @@ virshCommaStringListComplete(const char *input, if (virStringListHasString((const char **)inputList, options[i])) continue; =20 - if (inputCopy && virAsprintf(&ret[nret], "%s,%s", inputCopy, optio= ns[i]) < 0) - return NULL; - if (!inputCopy) + if (inputCopy) + virAsprintf(&ret[nret], "%s,%s", inputCopy, options[i]); + else ret[nret] =3D g_strdup(options[i]); =20 nret++; diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index bfff08b0f6..9178e534d6 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -431,10 +431,9 @@ cmdDomblkinfoGet(const virDomainBlockInfo *info, *alloc =3D g_strdup("-"); *phy =3D g_strdup("-"); } else if (!human) { - if (virAsprintf(cap, "%llu", info->capacity) < 0 || - virAsprintf(alloc, "%llu", info->allocation) < 0 || - virAsprintf(phy, "%llu", info->physical) < 0) - return false; + virAsprintf(cap, "%llu", info->capacity); + virAsprintf(alloc, "%llu", info->allocation); + virAsprintf(phy, "%llu", info->physical); } else { double val_cap, val_alloc, val_phy; const char *unit_cap, *unit_alloc, *unit_phy; @@ -443,10 +442,9 @@ cmdDomblkinfoGet(const virDomainBlockInfo *info, val_alloc =3D vshPrettyCapacity(info->allocation, &unit_alloc); val_phy =3D vshPrettyCapacity(info->physical, &unit_phy); =20 - if (virAsprintf(cap, "%.3lf %s", val_cap, unit_cap) < 0 || - virAsprintf(alloc, "%.3lf %s", val_alloc, unit_alloc) < 0 || - virAsprintf(phy, "%.3lf %s", val_phy, unit_phy) < 0) - return false; + virAsprintf(cap, "%.3lf %s", val_cap, unit_cap); + virAsprintf(alloc, "%.3lf %s", val_alloc, unit_alloc); + virAsprintf(phy, "%.3lf %s", val_phy, unit_phy); } =20 return true; @@ -828,10 +826,9 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) if (virMacAddrParse(iface, &macaddr) =3D=3D 0) virMacAddrFormat(&macaddr, macstr); =20 - if (virAsprintf(&xpath, "/domain/devices/interface[(mac/@address =3D '= %s') or " - " (target/@dev =3D '%= s')]", - macstr, iface) < 0) - goto cleanup; + virAsprintf(&xpath, "/domain/devices/interface[(mac/@address =3D '%s')= or " + " (target/@dev =3D '%s')]", macst= r, + iface); =20 if ((ninterfaces =3D virXPathNodeSet(xpath, ctxt, &interfaces)) < 0) { vshError(ctl, _("Failed to extract interface information")); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2f3ac2d430..7a03c1fb6e 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5535,11 +5535,8 @@ virshGenFileName(vshControl *ctl, virDomainPtr dom, = const char *mime) localtime_r(&cur_time, &time_info); strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info); =20 - if (virAsprintf(&ret, "%s-%s%s", virDomainGetName(dom), - timestr, NULLSTR_EMPTY(ext)) < 0) { - vshError(ctl, "%s", _("Out of memory")); - return NULL; - } + virAsprintf(&ret, "%s-%s%s", virDomainGetName(dom), timestr, + NULLSTR_EMPTY(ext)); =20 return ret; } @@ -6969,8 +6966,7 @@ virshVcpuPinQuery(vshControl *ctl, cpumaplen))) goto cleanup; =20 - if (virAsprintf(&vcpuStr, "%zu", i) < 0) - goto cleanup; + virAsprintf(&vcpuStr, "%zu", i); =20 if (vshTableRowAppend(table, vcpuStr, pinInfo, NULL) < 0) goto cleanup; @@ -7586,8 +7582,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) g_autofree char *pinInfo =3D NULL; g_autofree char *iothreadIdStr =3D NULL; =20 - if (virAsprintf(&iothreadIdStr, "%u", info[i]->iothread_id) < 0) - goto cleanup; + virAsprintf(&iothreadIdStr, "%u", info[i]->iothread_id); =20 ignore_value(pinInfo =3D virBitmapDataFormat(info[i]->cpumap, info= [i]->cpumaplen)); =20 @@ -11391,8 +11386,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) =20 /* Create our XPATH lookup for the current display's port */ VIR_FREE(xpath); - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "@port") < 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "@port"); =20 /* Attempt to get the port number for the current graphics scheme = */ tmp =3D virXPathInt(xpath, ctxt, &port); @@ -11405,8 +11399,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) =20 /* Create our XPATH lookup for TLS Port (automatically skipped * for unsupported schemes */ - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "@tlsPort") < 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "@tlsPort"); =20 /* Attempt to get the TLS port number */ tmp =3D virXPathInt(xpath, ctxt, &tls_port); @@ -11415,8 +11408,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) tls_port =3D 0; =20 /* Create our XPATH lookup for the current display's address */ - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "@listen") < 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "@listen"); =20 /* Attempt to get the listening addr if set for the current * graphics scheme */ @@ -11425,8 +11417,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) VIR_FREE(xpath); =20 /* Create our XPATH lookup for the current spice type. */ - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "listen/@type") <= 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "listen/@type"); =20 /* Attempt to get the type of spice connection */ VIR_FREE(type_conn); @@ -11435,8 +11426,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) =20 if (STREQ_NULLABLE(type_conn, "socket")) { if (!sockpath) { - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "listen/@= socket") < 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "listen/@sock= et"); =20 sockpath =3D virXPathString(xpath, ctxt); =20 @@ -11456,8 +11446,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) * subelement (which, by the way, doesn't exist on libvirt * < 0.9.4, so we really do need to check both places) */ - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "listen/@addr= ess") < 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "listen/@address"= ); =20 listen_addr =3D virXPathString(xpath, ctxt); VIR_FREE(xpath); @@ -11493,8 +11482,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) * care of when getting the XML */ =20 /* Create our XPATH lookup for the password */ - if (virAsprintf(&xpath, xpath_fmt, scheme[iter], "@passwd") < 0) - goto cleanup; + virAsprintf(&xpath, xpath_fmt, scheme[iter], "@passwd"); =20 /* Attempt to get the password */ VIR_FREE(passwd); diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 9ecbdb5af6..fe172d2c29 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1140,8 +1140,7 @@ vshExtractCPUDefXMLs(vshControl *ctl, else doc =3D buffer; =20 - if (virAsprintf(&xmlStr, "%s", doc) < 0) - goto error; + virAsprintf(&xmlStr, "%s", doc); =20 if (!(xml =3D virXMLParseStringCtxt(xmlStr, xmlFile, &ctxt))) goto error; diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index b83e385d00..fbeb40fc6a 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -893,11 +893,12 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd) goto cleanup; } =20 - if (stp && - ((virAsprintf(&delay_str, "%d", delay) < 0) || - !xmlSetProp(br_node, BAD_CAST "delay", BAD_CAST delay_str))) { - vshError(ctl, _("Failed to set bridge delay %d in xml document"), = delay); - goto cleanup; + if (stp) { + virAsprintf(&delay_str, "%d", delay); + if (!xmlSetProp(br_node, BAD_CAST "delay", BAD_CAST delay_str)) { + vshError(ctl, _("Failed to set bridge delay %d in xml document= "), delay); + goto cleanup; + } } =20 /* Change the type of the outer/master interface to "bridge" and the diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 64b733adcc..662ca00e1c 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1447,8 +1447,7 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *c= md) else if (lease->type =3D=3D VIR_IP_ADDR_TYPE_IPV6) typestr =3D "ipv6"; =20 - ignore_value(virAsprintf(&cidr_format, "%s/%d", - lease->ipaddr, lease->prefix)); + virAsprintf(&cidr_format, "%s/%d", lease->ipaddr, lease->prefix); =20 if (vshTableRowAppend(table, expirytime, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index bd876aefda..5138a5946c 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1286,19 +1286,16 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GN= UC_UNUSED) const char *unit; =20 val =3D vshPrettyCapacity(info.capacity, &unit); - if (virAsprintf(&poolInfoTexts[i].capacity, - "%.2lf %s", val, unit) < 0) - goto cleanup; + virAsprintf(&poolInfoTexts[i].capacity, "%.2lf %s", va= l, + unit); =20 val =3D vshPrettyCapacity(info.allocation, &unit); - if (virAsprintf(&poolInfoTexts[i].allocation, - "%.2lf %s", val, unit) < 0) - goto cleanup; + virAsprintf(&poolInfoTexts[i].allocation, "%.2lf %s", = val, + unit); =20 val =3D vshPrettyCapacity(info.available, &unit); - if (virAsprintf(&poolInfoTexts[i].available, - "%.2lf %s", val, unit) < 0) - goto cleanup; + virAsprintf(&poolInfoTexts[i].available, "%.2lf %s", v= al, + unit); } else { /* Capacity related information isn't available */ poolInfoTexts[i].capacity =3D g_strdup(_("-")); diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index d09d4435ad..bd57fd695d 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1430,14 +1430,11 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNU= C_UNUSED) volInfoTexts[i].type =3D g_strdup(virshVolumeTypeToString(= volumeInfo.type)); =20 val =3D vshPrettyCapacity(volumeInfo.capacity, &unit); - if (virAsprintf(&volInfoTexts[i].capacity, - "%.2lf %s", val, unit) < 0) - goto cleanup; + virAsprintf(&volInfoTexts[i].capacity, "%.2lf %s", val, un= it); =20 val =3D vshPrettyCapacity(volumeInfo.allocation, &unit); - if (virAsprintf(&volInfoTexts[i].allocation, - "%.2lf %s", val, unit) < 0) - goto cleanup; + virAsprintf(&volInfoTexts[i].allocation, "%.2lf %s", val, + unit); } } } diff --git a/tools/virt-admin.c b/tools/virt-admin.c index f3ae011cf4..da28d760db 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -394,8 +394,7 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd G_GNUC_UN= USED) =20 for (i =3D 0; i < nsrvs; i++) { g_autofree char *idStr =3D NULL; - if (virAsprintf(&idStr, "%zu", i) < 0) - goto cleanup; + virAsprintf(&idStr, "%zu", i); =20 if (vshTableRowAppend(table, idStr, @@ -656,8 +655,7 @@ cmdSrvClientsList(vshControl *ctl, const vshCmd *cmd) ×tr) < 0) goto cleanup; =20 - if (virAsprintf(&idStr, "%llu", id) < 0) - goto cleanup; + virAsprintf(&idStr, "%llu", id); if (vshTableRowAppend(table, idStr, vshAdmClientTransportToString(transport), timestr, NULL) < 0) diff --git a/tools/vsh.c b/tools/vsh.c index 3f8b7f2186..8cd613bbbd 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1795,28 +1795,27 @@ vshCommandOptTimeoutToMs(vshControl *ctl, const vsh= Cmd *cmd, int *timeout) char * vshGetTypedParamValue(vshControl *ctl, virTypedParameterPtr item) { - int ret =3D 0; char *str =3D NULL; =20 switch (item->type) { case VIR_TYPED_PARAM_INT: - ret =3D virAsprintf(&str, "%d", item->value.i); + virAsprintf(&str, "%d", item->value.i); break; =20 case VIR_TYPED_PARAM_UINT: - ret =3D virAsprintf(&str, "%u", item->value.ui); + virAsprintf(&str, "%u", item->value.ui); break; =20 case VIR_TYPED_PARAM_LLONG: - ret =3D virAsprintf(&str, "%lld", item->value.l); + virAsprintf(&str, "%lld", item->value.l); break; =20 case VIR_TYPED_PARAM_ULLONG: - ret =3D virAsprintf(&str, "%llu", item->value.ul); + virAsprintf(&str, "%llu", item->value.ul); break; =20 case VIR_TYPED_PARAM_DOUBLE: - ret =3D virAsprintf(&str, "%f", item->value.d); + virAsprintf(&str, "%f", item->value.d); break; =20 case VIR_TYPED_PARAM_BOOLEAN: @@ -1831,7 +1830,7 @@ vshGetTypedParamValue(vshControl *ctl, virTypedParame= terPtr item) vshError(ctl, _("unimplemented parameter type %d"), item->type); } =20 - if (ret < 0) { + if (!str) { vshError(ctl, "%s", _("Out of memory")); exit(EXIT_FAILURE); } @@ -2419,10 +2418,7 @@ vshEditWriteToTempFile(vshControl *ctl, const char *= doc) =20 tmpdir =3D getenv("TMPDIR"); if (!tmpdir) tmpdir =3D "/tmp"; - if (virAsprintf(&ret, "%s/virshXXXXXX.xml", tmpdir) < 0) { - vshError(ctl, "%s", _("out of memory")); - return NULL; - } + virAsprintf(&ret, "%s/virshXXXXXX.xml", tmpdir); fd =3D mkostemps(ret, 4, O_CLOEXEC); if (fd =3D=3D -1) { vshError(ctl, _("mkostemps: failed to create temporary file: %s"), @@ -2940,8 +2936,7 @@ vshReadlineInit(vshControl *ctl) rl_completer_quote_characters =3D quote_characters; rl_char_is_quoted_p =3D vshReadlineCharIsQuoted; =20 - if (virAsprintf(&histsize_env, "%s_HISTSIZE", ctl->env_prefix) < 0) - goto cleanup; + virAsprintf(&histsize_env, "%s_HISTSIZE", ctl->env_prefix); =20 /* Limit the total size of the history buffer */ if ((histsize_str =3D getenv(histsize_env))) { @@ -2967,15 +2962,9 @@ vshReadlineInit(vshControl *ctl) goto cleanup; } =20 - if (virAsprintf(&ctl->historydir, "%s/%s", userdir, ctl->name) < 0) { - vshError(ctl, "%s", _("Out of memory")); - goto cleanup; - } + virAsprintf(&ctl->historydir, "%s/%s", userdir, ctl->name); =20 - if (virAsprintf(&ctl->historyfile, "%s/history", ctl->historydir) < 0)= { - vshError(ctl, "%s", _("Out of memory")); - goto cleanup; - } + virAsprintf(&ctl->historyfile, "%s/history", ctl->historydir); =20 read_history(ctl->historyfile); ret =3D 0; @@ -3057,8 +3046,7 @@ vshInitDebug(vshControl *ctl) char *env =3D NULL; =20 if (ctl->debug =3D=3D VSH_DEBUG_DEFAULT) { - if (virAsprintf(&env, "%s_DEBUG", ctl->env_prefix) < 0) - return -1; + virAsprintf(&env, "%s_DEBUG", ctl->env_prefix); =20 /* log level not set from commandline, check env variable */ debugEnv =3D getenv(env); @@ -3076,8 +3064,7 @@ vshInitDebug(vshControl *ctl) } =20 if (ctl->logfile =3D=3D NULL) { - if (virAsprintf(&env, "%s_LOG_FILE", ctl->env_prefix) < 0) - return -1; + virAsprintf(&env, "%s_LOG_FILE", ctl->env_prefix); =20 /* log file not set from cmdline */ debugEnv =3D getenv(env); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list