From nobody Sun Feb 8 21:11:39 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=1646229346; cv=none; d=zohomail.com; s=zohoarc; b=hSni6aBoCWBUMvs9UVhEtxxHDYAkrZCfQambRMM34O43YH0n/jX1qGmII3TJ+BapQvOXneKREyrJ97vXQNbwfYquGlOh2+Xzuc9FnMe0+Zkt22ezJdVnY8FfkJXcolhyE+ibpxK9Vb5arUw8ScNqwh3am7+iV4Vg7ZKZWC9G3Ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646229346; 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=5CGCyHDnc4aNNgi/O9epoHR5UPHxB6eTMVPmqduJ+ag=; b=OA6o8CL99stT5Q4xEjb83BKW2CpMqeLy6vTia4D89TAYgtcfd2Ein1G53canrzj74VmsiiEMQcisB1EV+bme9Vool/goAKuoNlVgX6d+milWNPOQFrfT7q9QveWUgK/cs9W13JIBtULY47AuC2qKQJ9nIb8FkpH78xCpehUQkuI= 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 1646229346157568.5733657999925; Wed, 2 Mar 2022 05:55:46 -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-623-FEGeG9ezPSiHHB03LNKZeQ-1; Wed, 02 Mar 2022 08:55:43 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95ED51091DA7; Wed, 2 Mar 2022 13:55:37 +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 3EFC47C0F7; Wed, 2 Mar 2022 13:55:37 +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 DBA571809C98; Wed, 2 Mar 2022 13:55:35 +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 222DtZ9t017414 for ; Wed, 2 Mar 2022 08:55:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5431B17B7D; Wed, 2 Mar 2022 13:55:35 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9BE0832B4 for ; Wed, 2 Mar 2022 13:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646229345; 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=5CGCyHDnc4aNNgi/O9epoHR5UPHxB6eTMVPmqduJ+ag=; b=iUclm6zvg/b1cwWW1aI9jdFU/u+TW8K0C9+8J/6auGiQweV0eiODeGO+VXw0ccYG+Y+CiA 0Rdl5Hgsut8A4N/KM52g7ucqnGEqgjxKlPtjAKJQj3ZRh5fdYdhVEk8yZ/pi21IW58jz/E sH+4+LbWCGJDaHp0wEFlx5OmGHLZxOk= X-MC-Unique: FEGeG9ezPSiHHB03LNKZeQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/23] virsh: doSave: Use if-else instead of ternary operator Date: Wed, 2 Mar 2022 14:55:02 +0100 Message-Id: <1005cdd4e4f279e5878fa2c9b2e97c3547d61be6.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.16 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: 1646229348318100001 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 4c90f40f86..607eb973ac 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4213,6 +4213,7 @@ doSave(void *opaque) unsigned int flags =3D 0; const char *xmlfile =3D NULL; g_autofree char *xml =3D NULL; + int rc; #ifndef WIN32 sigset_t sigmask, oldsigmask; @@ -4244,9 +4245,13 @@ doSave(void *opaque) goto out; } - if (((flags || xml) - ? virDomainSaveFlags(dom, to, xml, flags) - : virDomainSave(dom, to)) < 0) { + if (flags || xml) { + rc =3D virDomainSaveFlags(dom, to, xml, flags); + } else { + rc =3D virDomainSave(dom, to); + } + + if (rc < 0) { vshError(ctl, _("Failed to save domain '%s' to %s"), name, to); goto out; } --=20 2.35.1