From nobody Sun Feb 8 07:07:55 2026 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=1564671657; cv=none; d=zoho.com; s=zohoarc; b=P8RzSX/2bhivYYJJ92edpsXb+Q50CHlTmUMwY1BveGadIJWLSqzWE114gaxLDVj1abfY3COZ+MJ2bAyL8B5RL7gv5g4aVPXPkrgEp3w+XTo4DnnZuICRGJjXFvv/d4drQhE8xJv7Fyv5adaXbVsQ55HuWTiL/ity2t3UHVGzYLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564671657; 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:ARC-Authentication-Results; bh=LNDMN/eLtQlJGY9dQETW+VzpfnEZ3O81BdTkpSw4WjQ=; b=nJ9HPrQ+okOUOqLP0IA95LWLyKumOdFvPoSEn4RtJUf1Gy0WMAQhAKtXU3gqKUBU21uCHiZbAgshxXIYC85TRCpBCmn0sEX7SsV71kkirgKC+jNjnE65ihIEOHg3zsCYSWXS8L10Vw+6ODnV6K6rIQSPPQzKxj2V5PIUalMb6hs= 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 1564671657309757.5021674419993; Thu, 1 Aug 2019 08:00:57 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 4374F8FAA0; Thu, 1 Aug 2019 15:00:55 +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 89A976062A; Thu, 1 Aug 2019 15:00:54 +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 78BB8180B536; Thu, 1 Aug 2019 15:00:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x71F0nbn032106 for ; Thu, 1 Aug 2019 11:00:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED9D119693; Thu, 1 Aug 2019 15:00:49 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (dhcp-94.gsslab.fab.redhat.com [10.33.9.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 605C5196FE; Thu, 1 Aug 2019 15:00:49 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 16:00:04 +0100 Message-Id: <20190801150019.10519-3-berrange@redhat.com> In-Reply-To: <20190801150019.10519-1-berrange@redhat.com> References: <20190801150019.10519-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/17] tools: fix double error reporting in 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 01 Aug 2019 15:00:56 +0000 (UTC) The public API entry points will call virDispatchError which will print to stderr by default. We then jump to a cleanup path which calls virDispatchError again. We tried to stop the entry points printing to stderr, but incorrectly called virSetErrorFunc. It needs a real function that is a no-op, not a NULL function. Once we fix virSetErrorFunc, then we need to use fprintf in the cleanup path instead of virDispatchError. Signed-off-by: Daniel P. Berrang=C3=A9 --- tools/virt-login-shell.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index b906fa9ed6..8ffc72ab9a 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -143,6 +143,12 @@ show_version(void) } =20 =20 +static void +hideErrorFunc(void *opaque ATTRIBUTE_UNUSED, + virErrorPtr err ATTRIBUTE_UNUSED) +{ +} + int main(int argc, char **argv) { @@ -186,7 +192,7 @@ main(int argc, char **argv) return EXIT_CANCELED; } =20 - virSetErrorFunc(NULL, NULL); + virSetErrorFunc(NULL, hideErrorFunc); virSetErrorLogPriorityFunc(NULL); =20 progname =3D argv[0]; @@ -403,7 +409,7 @@ main(int argc, char **argv) =20 if (saved_err) { virSetError(saved_err); - virDispatchError(NULL); + fprintf(stderr, "%s: %s\n", argv[0], virGetLastErrorMessage()); } return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list