From nobody Mon Feb 9 07:26:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1646229543; cv=none; d=zohomail.com; s=zohoarc; b=DkYEGq1Tu112rzzJhmfnpM+TgzV6wNE8GRaFAYCREH+nX7Id+Oq4pInnKehVJBCK4pAqSR7t9zMTFC5UhrcKDqyLel83eoPS4Bs645uV6zDerhWGMaAFCU0adKZ7fqudBiBGDjRCXuQQtQWQ1EV2S5VTDBL3Tq1lv2zZCBVErpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646229543; 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=5d/+c2TcJ+58bRAiQe9x0qthMGzQg9VO6+5r5+tvjec=; b=XZc6aDxl5wKBOUzh4DDuvmx3Yqnm7xUp0WmktoiWkTub6B9k6Jzq74Mp5A67u052Dq6vxsoZXqRwr0FDuNS/9QNsPWE0fiz84ins4tGp/d1RDjZ4riBSGSVF4pkNgNR5XtZSowewXjaI01/iY+eNckOMyTEI73Z6QB1jzdNoNvw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1646229543545449.96072166268095; Wed, 2 Mar 2022 05:59:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-NCgYgfFVOiKw7NQPSNc10Q-1; Wed, 02 Mar 2022 08:56:03 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEB5E1006AAF; Wed, 2 Mar 2022 13:55:58 +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 B1D278495E; Wed, 2 Mar 2022 13:55:58 +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 7190846F98; Wed, 2 Mar 2022 13:55:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 222Dtaul017419 for ; Wed, 2 Mar 2022 08:55:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6660A17B7D; Wed, 2 Mar 2022 13:55:36 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C19AE8359B for ; Wed, 2 Mar 2022 13:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646229542; 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=5d/+c2TcJ+58bRAiQe9x0qthMGzQg9VO6+5r5+tvjec=; b=UGHdAZeyAE7e0tRaiL6tB8WTBQePcH0Uxib+RQ7a9sfel6KsEY7KA6LbbxjWgpdg/xhOVN VPDkLI4NdVpHTB11rIdW1WiqL0D7twzf+bwMXPZ2BM2KjqVg5/9r1effEoCmwls97wxDf9 I2nul5enbjzt7F739Bm7AZBVtKsRclk= X-MC-Unique: NCgYgfFVOiKw7NQPSNc10Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/23] virsh: cmdRestore: Use if-else instead of ternary operator Date: Wed, 2 Mar 2022 14:55:03 +0100 Message-Id: <5041c763c672b2001b52d4883e03c3c2e2a396a5.1646229193.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1646229544398100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 607eb973ac..732690ec44 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5313,6 +5313,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) const char *xmlfile =3D NULL; g_autofree char *xml =3D NULL; virshControl *priv =3D ctl->privData; + int rc; if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) return false; @@ -5333,9 +5334,13 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0) return false; - if (((flags || xml) - ? virDomainRestoreFlags(priv->conn, from, xml, flags) - : virDomainRestore(priv->conn, from)) < 0) { + if (flags || xml) { + rc =3D virDomainRestoreFlags(priv->conn, from, xml, flags); + } else { + rc =3D virDomainRestore(priv->conn, from); + } + + if (rc < 0) { vshError(ctl, _("Failed to restore domain from %s"), from); return false; } --=20 2.35.1