From nobody Mon Feb 9 00:55:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1573650450; cv=none; d=zoho.com; s=zohoarc; b=brSyHsnboXdAPtVOTLykLIKWDpelAOcHRMuXxUm0R3eAqLxN5l/xGr0Yb4TOS0sy+TpBYu8oLRXn1ORYHtbuMLHN+M5Q7Ic4p0CIOM2gIe0Jy/QnviW19nYUIJfcNU8dm0UrIsMPq5dktfciwb7WYfF9ujWiHRS4Wt2VEsHVuzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573650450; 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=xsLf4BS5Lv3y7IfYHYEgv4UJnAwIjSuiMan9yrwmnSA=; b=kOMo5+c8/JCVBku64eG4jEzqYPGU1nmAFT8iIqoDz3TB5ULRqGh9X7buDmzJAAVWLyt6veWgtATcvhSVB460SREshJ3toS0Yw4JAGVCNGfCDyB8HWrdmLbdUZ4gmzYFBIu9jReBkZ64+CsErDKf6brrmloIBJkKSDv9HFZ7ny/c= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 157365045004989.40747177808646; Wed, 13 Nov 2019 05:07:30 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-PlBh2gSHNx2thEoe52fBgg-1; Wed, 13 Nov 2019 08:07:26 -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 477BB801E54; Wed, 13 Nov 2019 13:07:20 +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 220E21B5B5; Wed, 13 Nov 2019 13:07:20 +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 8EECC65D1E; Wed, 13 Nov 2019 13:07:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xADD7G1K007083 for ; Wed, 13 Nov 2019 08:07:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id C21A3BA45; Wed, 13 Nov 2019 13:07:16 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AFC060CCC for ; Wed, 13 Nov 2019 13:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573650448; 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=xsLf4BS5Lv3y7IfYHYEgv4UJnAwIjSuiMan9yrwmnSA=; b=GSygfUw/6erb7SkM5UZzLSwYTmJmIUtaSktzN/F9k0YbZK9HW660PMBB/aTB7p10KSSBcb Zw9LaUnsm/l5NQqS4HC9f7nZedFxiPT49zNu9h9BQWpr4o4FHHAY0CccnmREkydXBEGHzK t+Ts+xwg6djzB97c0k26kCTuj9hlTpA= From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 14:07:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] qemu: tpm: Sanitize error values in qemuTPMEmulatorGetPid 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 X-MC-Unique: PlBh2gSHNx2thEoe52fBgg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The callers don't care about the actual return value, so return -1 rather than errno. Signed-off-by: Peter Krempa --- src/qemu/qemu_tpm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 40136c4410..2f92542470 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -266,7 +266,7 @@ qemuTPMEmulatorCreatePidFilename(const char *swtpmState= Dir, * @shortName: short name of the domain * @pid: pointer to pid * - * Return -errno upon error, or zero on successful reading of the pidfile. + * Return -1 upon error, or zero on successful reading of the pidfile. * If the PID was not still alive, zero will be returned, and @pid will be * set to -1; */ @@ -275,16 +275,16 @@ qemuTPMEmulatorGetPid(const char *swtpmStateDir, const char *shortName, pid_t *pid) { - int ret; g_autofree char *swtpm =3D virTPMGetSwtpm(); g_autofree char *pidfile =3D qemuTPMEmulatorCreatePidFilename(swtpmSta= teDir, shortName); if (!pidfile) - return -ENOMEM; + return -1; - ret =3D virPidFileReadPathIfAlive(pidfile, pid, swtpm); + if (virPidFileReadPathIfAlive(pidfile, pid, swtpm) < 0) + return -1; - return ret; + return 0; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list