From nobody Mon Feb 9 16:02:37 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=1639152561; cv=none; d=zohomail.com; s=zohoarc; b=HSPbEKl8gfUgePVRPMoid+WHGtBpVO2f+GsoiV6YpFOtT/YcNA01vYsv7KBq4eCSUkD5Al9AWxFXtiH0x+67zZfUUOouy7JXDK14b8G8NYOYVWAJ4rkK5i33MK9QvPPheQ6JVuVnV/dP19VTt9L8ORK8jeOCzbbt1I9pwOLGML0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639152561; 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=cbQxoqKgDYUv84B71ql93OhMtPbvm7nHkz9F1YuyNOc=; b=QWv+A56yhzaSPZbV8EdZgv5YC1ptEtdxFSYiObQ/il95IJ4iURYsvmX/t/pUMSRhLpli6Zq2+bxIUVfDvP/fagh3a732OhCUNl010WhIl3MvlhcBG9z5Y2PmpGET8zFQTz6ujmrkqJH7PqC+ECCqMJM7NhDaX5UF6i6tQCPNfyI= 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 1639152561529439.93148741354014; Fri, 10 Dec 2021 08:09:21 -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-600-ADAj59qbP4aSS8OEAmHHkg-1; Fri, 10 Dec 2021 11:09:18 -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 3257581CCB4; Fri, 10 Dec 2021 16:09:12 +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 0977B78C2B; Fri, 10 Dec 2021 16:09:11 +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 8A2F14A707; Fri, 10 Dec 2021 16:09:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BAG6jQS015336 for ; Fri, 10 Dec 2021 11:06:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id CFD274ABA2; Fri, 10 Dec 2021 16:06:45 +0000 (UTC) Received: from kinshicho.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.40.194.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0E5660622 for ; Fri, 10 Dec 2021 16:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639152560; 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=cbQxoqKgDYUv84B71ql93OhMtPbvm7nHkz9F1YuyNOc=; b=SOH0vjzfvre+nEAzZvpQQGm6+mbLVVF60e7ZaavcNPk4bBUxJNZR4hZeMwJcR00cK0cekv R+ChIuLs542IqUc8hksSbay8cjhh1PFUV8VFmkxDhi7jEKaYkzSPieXu/SB5iAbbCTtEFO EoR1lduPDHeYTrmE1QWWg0qY1kjJWTM= X-MC-Unique: ADAj59qbP4aSS8OEAmHHkg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] virt-ssh-helper: Don't use optind Date: Fri, 10 Dec 2021 17:06:29 +0100 Message-Id: <20211210160634.366061-2-abologna@redhat.com> In-Reply-To: <20211210160634.366061-1-abologna@redhat.com> References: <20211210160634.366061-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1639152563309100003 Content-Type: text/plain; charset="utf-8" It's a getopt interface and we're not using getopt, at least directly, so even though it works relying on it feels wrong. GOption takes care of removing any trace of the arguments it consumes from argc and argv, leaving behind only non-option arguments, so we can just use those standard variables. Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/remote/remote_ssh_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c index 0945b90331..092676dd74 100644 --- a/src/remote/remote_ssh_helper.c +++ b/src/remote/remote_ssh_helper.c @@ -395,12 +395,12 @@ int main(int argc, char **argv) /* Initialize the log system */ virLogSetFromEnv(); =20 - if (optind !=3D (argc - 1)) { + if (argc !=3D 2) { g_printerr("%s: expected a URI\n", argv[0]); exit(EXIT_FAILURE); } =20 - uri_str =3D argv[optind]; + uri_str =3D argv[1]; VIR_DEBUG("Using URI %s", uri_str); =20 if (!(uri =3D virURIParse(uri_str))) { --=20 2.31.1