From nobody Sun Feb 8 17:13:02 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1542663454176420.47897544415946; Mon, 19 Nov 2018 13:37:34 -0800 (PST) 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 C97275D5EA; Mon, 19 Nov 2018 21:37:32 +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 7F8DE6090A; Mon, 19 Nov 2018 21:37:32 +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 E926C3F7D0; Mon, 19 Nov 2018 21:37:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAJLaX9g005823 for ; Mon, 19 Nov 2018 16:36:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0FB855D772; Mon, 19 Nov 2018 21:36:33 +0000 (UTC) Received: from wheatley (ovpn-204-97.brq.redhat.com [10.40.204.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCAE35D760; Mon, 19 Nov 2018 21:36:29 +0000 (UTC) Received: from wheatley.lan (wheatley.usersys.redhat.com [127.0.0.1]) by wheatley (Postfix) with ESMTP id 332587E0037; Mon, 19 Nov 2018 22:36:28 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 19 Nov 2018 22:35:56 +0100 Message-Id: <615106fb10f0f8df6fb2c361b1349bdb7dd5a942.1542663328.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: abologna@redhat.com Subject: [libvirt] [PATCH v3 1/2] qemu: Fix virDoes*Exist usage 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-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.39]); Mon, 19 Nov 2018 21:37:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The virGet*ID() functions should be called only if the user exists not when= it doesn't. Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/qemu/qemu_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 32da9a735184..a946b05d5d47 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -193,10 +193,10 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool pr= ivileged) if (virAsprintf(&cfg->swtpmStorageDir, "%s/lib/libvirt/swtpm", LOCALSTATEDIR) < 0) goto error; - if (virDoesUserExist("tss") !=3D 0 || + if (!virDoesUserExist("tss") || virGetUserID("tss", &cfg->swtpm_user) < 0) cfg->swtpm_user =3D 0; /* fall back to root */ - if (virDoesGroupExist("tss") !=3D 0 || + if (!virDoesGroupExist("tss") || virGetGroupID("tss", &cfg->swtpm_group) < 0) cfg->swtpm_group =3D 0; /* fall back to root */ } else { --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list