From nobody Thu May 2 08:16:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1569601393; cv=none; d=zoho.com; s=zohoarc; b=iu+4UhyjboDj7154lIZSpBkNmrhnEofBUT9LO+5PBLfBiWQ5Iyq3YWZxsxos2DFOxuCOhJU4KIIUT+gC4DJhz9du2Wd2zShs4RvgfIR0F5Wy9V1TQGIVdHkJlX4btj01Nv/3G3yJJjr/WrfwV5wlWWeB70yV2WmfObGr6bXus5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569601393; 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:ARC-Authentication-Results; bh=em/Osce/C27w2w50CeC47Ms0ZOOSMzjfa/Y5ZBJhOEE=; b=mRM2oMED/WhK7F4JSPsaPEVWQ6Q65V+FHQ+Fuv2IVRwgDjlKOZeBPkJJWKGOiLNMYabwlbaq8VLy74wwrGs1UxuZYhtS11WmxDfadr8XOfEh+J5KQfygGIK1QCPviqavVgsuhM4khiPG3Y7SFG59vVaTPk+gR4ieDAFWCeBQc6s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569601393549601.1631053622689; Fri, 27 Sep 2019 09:23:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B9FD7BDA1; Fri, 27 Sep 2019 16:23:11 +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 EF5F4196B2; Fri, 27 Sep 2019 16:23:10 +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 B58A74EDA6; Fri, 27 Sep 2019 16:23:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8RGN8Qi013902 for ; Fri, 27 Sep 2019 12:23:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 611115D9D5; Fri, 27 Sep 2019 16:23:08 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 830BD5D9C3; Fri, 27 Sep 2019 16:23:04 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 27 Sep 2019 17:23:02 +0100 Message-Id: <20190927162302.22713-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] tools: fix regression passing command with virt-login-shell 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 27 Sep 2019 16:23:12 +0000 (UTC) It is documented that a command to run inside the container can be passed with the -c arg. virt-login-shell -c "ls -l /" This fixes commit 4feeb2d986b98013ebfb1d41ab6b9007b6cce6e2 Author: Daniel P. Berrang=C3=A9 Date: Thu Aug 1 10:58:31 2019 +0100 tools: split virt-login-shell into two binaries Signed-off-by: Daniel P. Berrang=C3=A9 --- tools/virt-login-shell.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index f92cc0a749..f5aa02420b 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -38,11 +38,13 @@ int main(int argc, char **argv) { char uidstr[INT_BUFSIZE_BOUND(uid_t)]; char gidstr[INT_BUFSIZE_BOUND(gid_t)]; - const char *const newargv[] =3D { + const char * newargv[] =3D { LIBEXECDIR "/virt-login-shell-helper", uidstr, gidstr, NULL, + NULL, + NULL, }; char *newenv[] =3D { NULL, @@ -60,8 +62,15 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } =20 - if (argc !=3D 1) { - fprintf(stderr, "%s: no arguments expected\n", argv[0]); + if (argc =3D=3D 3) { + if (strcmp(argv[1], "-c") !=3D 0) { + fprintf(stderr, "%s: syntax: %s [-c CMDSTR]\n", argv[0], argv[= 0]); + exit(EXIT_FAILURE); + } + newargv[3] =3D argv[1]; + newargv[4] =3D argv[2]; + } else if (argc !=3D 1) { + fprintf(stderr, "%s: syntax: %s [-c CMDSTR]\n", argv[0], argv[0]); exit(EXIT_FAILURE); } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list