From nobody Fri May 3 19:05:03 2024 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=1639480628; cv=none; d=zohomail.com; s=zohoarc; b=ZtS1jnK3OMzjkAbVFPUvVvUq0yrdQ+hK1jKvcC/rulx4FjvcuOqtuhxsip5j0tVBT//9u6nkuhQDoQtMmSboCacDxz4/vM6pjhaJ7/RlPldPveHgI6rbCEo9wSmlfLtPLf6uLSXatqMeAq7pjccWQjRu7k6sghNq5LXrK4IV4II= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639480628; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ZSoB2RzcXsg9Dzu0ZK33keKM8ZTU1m1SPEE3BLPPmuM=; b=IulXMrrWdl8/46Y6dU0a5IftAjbmC6j5+7CzstB5Q3eneD7BlZ5ZSUNgDnlfSkGH4+vNy8xvqq/XVG/UdeNt0P5Ntw44uBNX490YJuk2LsvtRdR2R9iTcMHutKDAFSVYpp9LpGX/gxMP7IhgMSvFnUiPuewemPxrwqUFGrI6BIw= 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 163948062804812.081906943647368; Tue, 14 Dec 2021 03:17:08 -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-461-yL7pua0nP1-No3GdFefZUg-1; Tue, 14 Dec 2021 06:16:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D109801B2A; Tue, 14 Dec 2021 11:16:30 +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 40E1D7D93D; Tue, 14 Dec 2021 11:16:30 +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 DA8971809CB8; Tue, 14 Dec 2021 11:16:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BEBFxl9022275 for ; Tue, 14 Dec 2021 06:15:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8B73E100EBAD; Tue, 14 Dec 2021 11:15:59 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 117991017E35 for ; Tue, 14 Dec 2021 11:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639480627; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZSoB2RzcXsg9Dzu0ZK33keKM8ZTU1m1SPEE3BLPPmuM=; b=c6RrD5mVAbtNZtj3wK31OTso8xMTotnJ6IWDe+l3FOrr7cvKUmgDqi8nuoRb6qg+x5q1t+ sgxjNJLfaGQaO/uSyXDypSzES8ebzmN0x0PspyFiAPIsW7sCFwVpc/KaXy3aDJdHO+bEKi ndJm2C7x+yawojEPzG64a8vGM+N3zxE= X-MC-Unique: yL7pua0nP1-No3GdFefZUg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] examples: hellolibvirt: fix argc check Date: Tue, 14 Dec 2021 12:15:35 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639480629731100002 https://gitlab.com/libvirt/libvirt/-/issues/255 Reported-by: Jeremy Alcim Signed-off-by: J=C3=A1n Tomko --- Pushed as trivial. examples/c/misc/hellolibvirt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/c/misc/hellolibvirt.c b/examples/c/misc/hellolibvirt.c index a598e01be2..39cefe934c 100644 --- a/examples/c/misc/hellolibvirt.c +++ b/examples/c/misc/hellolibvirt.c @@ -107,11 +107,12 @@ main(int argc, char *argv[]) { int ret =3D 0; virConnectPtr conn; - char *uri; + char *uri =3D NULL; =20 printf("Attempting to connect to hypervisor\n"); =20 - uri =3D (argc > 0 ? argv[1] : NULL); + if (argc > 1) + uri =3D argv[1]; =20 /* virConnectOpenAuth is called here with all default parameters, * except, possibly, the URI of the hypervisor. */ --=20 2.31.1