From nobody Sun Feb 8 10:21:42 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1614701553; cv=none; d=zohomail.com; s=zohoarc; b=Qhtx+WeNfD7uzXpRhGJWRAQejuFh/Ehy8613jIgFsmjFEOLs2Dx5/0G2NmGL7KjlS5pz8TtxQV0ZV5/Ca/Q0UNtWPImo5VGRyHLPQjG7cQTst41R9n0+x5TySRkdvoZpsva8GP9nrKS9/e6WwzuJgSUZIzfSzNCp3QjniQa0rcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614701553; 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=ae0pzHUZO38q+7bXCMcZ9h1HnU+UaQCbkA+z6Mim2v0=; b=LbwsrPsSbb5LreeDeLgbrOqD9eL52u6GJtwfmDkkDcMPx48WnBgz3PH18pjZjwqPUzzkEhxIgtcAaLwHpsNRfsWWDbsssVctwDZ3gZWqQhCLvE0wlKPCmvb/Df0oifBxsYfvf05wJZM3wBCSdmZ2N2MDYEyGannpAxy4OB8pIXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614701553048764.972251644863; Tue, 2 Mar 2021 08:12:33 -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-271-UHp81Q4_OKOn8F5P3_Idrw-1; Tue, 02 Mar 2021 11:12:29 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52F36803F47; Tue, 2 Mar 2021 16:12:23 +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 1E1AE5D9F1; Tue, 2 Mar 2021 16:12:23 +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 CEA8A57DFE; Tue, 2 Mar 2021 16:12:22 +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 122GCMRd024024 for ; Tue, 2 Mar 2021 11:12:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5630260BFA; Tue, 2 Mar 2021 16:12:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1D8360C05 for ; Tue, 2 Mar 2021 16:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614701552; 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=ae0pzHUZO38q+7bXCMcZ9h1HnU+UaQCbkA+z6Mim2v0=; b=BvrZ0FapMNDD4ecptEUlhPRIeRn2mcOMQyKG+KoJ1HcgRnOBy55rrO3mmHrCduJIHEJy9W KzFRaCtiTuwUjIEBLORXejJH2743SJjR7NuoeR1gkeHshsn5nDc9mpdCpd40w1MvvLBJxM xhoCaKtvoCNYvj/6HzZfy9uo8QVVSs4= X-MC-Unique: UHp81Q4_OKOn8F5P3_Idrw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] virCommandFDSet: Remove return value Date: Tue, 2 Mar 2021 17:12:06 +0100 Message-Id: <187f93cbb691403e0863a8db3b5a098a84f321cc.1614701477.git.pkrempa@redhat.com> In-Reply-To: References: 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.14 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) Content-Type: text/plain; charset="utf-8" The function can't fail nowadays. Remove the return value and adjust the only caller which ensures that @cmd is non-NULL and @fd is positive. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/vircommand.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 2f6635671d..579c77fd9f 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -216,27 +216,19 @@ virCommandFDIsSet(virCommandPtr cmd, * This is practically generalized implementation * of FD_SET() as we do not want to be limited * by FD_SETSIZE. - * - * Returns: 0 on success, - * -1 on usage error, */ -static int +static void virCommandFDSet(virCommandPtr cmd, int fd, unsigned int flags) { - if (!cmd || fd < 0) - return -1; - if (virCommandFDIsSet(cmd, fd)) - return 0; + return; ignore_value(VIR_EXPAND_N(cmd->passfd, cmd->npassfd, 1)); cmd->passfd[cmd->npassfd - 1].fd =3D fd; cmd->passfd[cmd->npassfd - 1].flags =3D flags; - - return 0; } #ifndef WIN32 @@ -1035,8 +1027,6 @@ virCommandNewVAList(const char *binary, va_list list) void virCommandPassFDIndex(virCommandPtr cmd, int fd, unsigned int flags, size_= t *idx) { - int ret =3D 0; - if (!cmd) { VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags); return; @@ -1050,13 +1040,7 @@ virCommandPassFDIndex(virCommandPtr cmd, int fd, uns= igned int flags, size_t *idx return; } - if ((ret =3D virCommandFDSet(cmd, fd, flags)) !=3D 0) { - if (!cmd->has_error) - cmd->has_error =3D ret; - VIR_DEBUG("cannot preserve %d", fd); - VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags); - return; - } + virCommandFDSet(cmd, fd, flags); if (idx) *idx =3D cmd->npassfd - 1; --=20 2.29.2