From nobody Sun Feb 8 10:29:59 2026 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=1636730585; cv=none; d=zohomail.com; s=zohoarc; b=MELZaHzyiVVrp/onrRS6kCGwx6uS6XL2r63kiT7HO2D50YR3BGWLNe01kYpjb3paFOxD0nCNQ9D5ir2gKpfGrVzLpLYhQzgAMrZA+R9ypuZqZLyvDrBA31htlZLrRQlJ5vbwsA0JHsCoDxG2AYs/TIlUCMWz6pbJpbJ08NDLIv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636730585; 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=RuZlbqUM1k3kPabzaWhPWHiWOneNSmDQjWux5PspNIc=; b=aGkQsSJgT+Cl2iN+eON6/PdcgKnGmTcuKDO5kPXldOVunagR+Y8L7SQPvHVMrIhzpzGJoQh4MEJdEE59XECp/w7/wj5QeI4/2jAtUkrGR6elY8KiQ75Bzy26NviupxstgpE8NuhkYUQYCf4YRQJ5zN4dQ0FDwQ6232kWirMs358= 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 1636730585468276.3137078287532; Fri, 12 Nov 2021 07:23:05 -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-66-OxdcH2DiM96zMg7q1ZD2tA-1; Fri, 12 Nov 2021 10:23:02 -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 C4C9019251A1; Fri, 12 Nov 2021 15:22:57 +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 A645960C05; Fri, 12 Nov 2021 15:22:57 +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 7B5511832DD9; Fri, 12 Nov 2021 15:22:57 +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 1ACFMjTM014387 for ; Fri, 12 Nov 2021 10:22:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1F59460C5F; Fri, 12 Nov 2021 15:22:45 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A34660C4A for ; Fri, 12 Nov 2021 15:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636730584; 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=RuZlbqUM1k3kPabzaWhPWHiWOneNSmDQjWux5PspNIc=; b=X0Ywi3iGMz+NTU5dkEkxfMOWtl7NKNaqDSIWya3vq4oRGJDdFwwEUjYFAcG5XJ1bPXxjQO bso6Sj38IB96BkzhprbzQv1MFj+nXt3Jj66TjByW3DiThBZYydhpC7nux/kTSWwq2Hg7kq knVO5iFeC3zgYZi42F0U6n+qMYEuyYo= X-MC-Unique: OxdcH2DiM96zMg7q1ZD2tA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] examples/dommigrate: Make retval portable Date: Fri, 12 Nov 2021 16:22:34 +0100 Message-Id: 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.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: 1636730587107100001 Content-Type: text/plain; charset="utf-8" Currently, the dommigrate example returns 0 or 1 for success or failure state, respectively. Except for a few cases where it forgot to change the @ret variable just before jumping onto the 'cleanup' label. Making the code follow our usual pattern (initialize @ret to an error value and set it to success value only at the end) fixes those cases. Also, using EXIT_SUCCESS and EXIT_FAILURE is more portable (even though on my system they are just an alias to values the example already uses). Signed-off-by: Michal Privoznik --- examples/c/domain/dommigrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/c/domain/dommigrate.c b/examples/c/domain/dommigrate.c index b1641efb9a..3d32ada6d3 100644 --- a/examples/c/domain/dommigrate.c +++ b/examples/c/domain/dommigrate.c @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { char *src_uri, *dst_uri, *domname; - int ret =3D 0; + int ret =3D EXIT_FAILURE; virConnectPtr conn =3D NULL; virDomainPtr dom =3D NULL; =20 @@ -52,7 +52,6 @@ main(int argc, char *argv[]) printf("Attempting to connect to the source hypervisor...\n"); conn =3D virConnectOpenAuth(src_uri, virConnectAuthPtrDefault, 0); if (!conn) { - ret =3D 1; fprintf(stderr, "No connection to the source hypervisor: %s.\n", virGetLastErrorMessage()); goto out; @@ -74,6 +73,7 @@ main(int argc, char *argv[]) } =20 printf("Migration finished with success.\n"); + ret =3D EXIT_SUCCESS; =20 cleanup: if (dom !=3D NULL) --=20 2.32.0