From nobody Tue May 7 18:56:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1641304069; cv=none; d=zohomail.com; s=zohoarc; b=Kh7g1aVfrJxm7dJXyp/67uzVxxHm5yzKwf4JPfk286WHRXHy9pGAM9oEVA8PQkZbWVvTXfTMEB/LD/PKCf4NfMeULaNDFOFgv49Rm2picxRU9fl7Z81UNnWX3IWepNNLUsWoj61/vbKCsV+0EzytqbvJbADLMxTWjv9X6wModx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304069; 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=vLkwx5sg5/4cI+o8XE5SoR9uWU2HL5nUx1P/JA+uS9k=; b=a4G7a6HZkBQQJ5bRfwdey8kADmghjtE5YWbpsLsDPGgO6mPCd/Jouder//Nd4MJoqLRKeTPUkyqUU8cutRRHTbJmBjl6cj/jHdRugCcjAHwh4JDPoULKO9y8psB50GHRrrisyW+lXD0kE850I7TDw5QVwWRgSvw8z1gfMybx/v8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1641304069599932.2014279604781; Tue, 4 Jan 2022 05:47:49 -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-281-OmbK0d6UNLi5mYurKlgTxQ-1; Tue, 04 Jan 2022 08:47:45 -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 D7BA51023F50; Tue, 4 Jan 2022 13:47:38 +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 B83577EBF7; Tue, 4 Jan 2022 13:47:38 +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 895E91802E2B; Tue, 4 Jan 2022 13:47:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlNII019610 for ; Tue, 4 Jan 2022 08:47:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 076AF1121333; Tue, 4 Jan 2022 13:47:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0398E1121330 for ; Tue, 4 Jan 2022 13:47:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F02711C093CA for ; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-367-tp3QH87pP_yzVSBCUvKlDQ-1; Tue, 04 Jan 2022 08:47:18 -0500 Received: by mail-wr1-f72.google.com with SMTP id r9-20020adfb1c9000000b001a2981d9356so11759376wra.20 for ; Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id c8sm40309424wmq.34.2022.01.04.05.47.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:16 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 61EED2FEE73D for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304068; 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=vLkwx5sg5/4cI+o8XE5SoR9uWU2HL5nUx1P/JA+uS9k=; b=VxomaU6eYmKEwIUqt6DELDPjYgPkCD4+TLxtca55SMdOnhe481fEs+PBCQxluxZX03fIS+ nt6u07iLDEWKoNARa9C1vLCsOHy15ZfTEtaVegELXQ9nM02Gc+CB5aV+XR5ObWGmaLM3EA CorsNd6qhIQH0BorXggQMRR6QoIG8kI= X-MC-Unique: OmbK0d6UNLi5mYurKlgTxQ-1 X-MC-Unique: tp3QH87pP_yzVSBCUvKlDQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vLkwx5sg5/4cI+o8XE5SoR9uWU2HL5nUx1P/JA+uS9k=; b=MMoYFGKp74Nu5P6YahH8pX6n0QROgPCjI8QBx/vUsmwnlbg8SdY7j9sxBcG7thJaQT EieiwRIMiR68v9lwiaIWblRKaMb8pdGyi+mtJDaXR15XCGDkmHAokn9h+t60yNEqqWNi MrgT/cuv8h4KfzsfB4sq2zPwohtlU2/19jSfj5YAhY5CE3AeAJNXDSksFTYZC8SZ9/HP 3fJ2mULw2JbBum+Rl7g4SmNJ6/07QlJaS4QwchbUpfgGmwmajBIeXmQpeFLcojJRjHyQ 5EcmNa/YW47voEzeP2vEsO7eSTmbsYd64mzNxYGuduLShCW/mnZKyvuDUGiBwPypf+TV IMUw== X-Gm-Message-State: AOAM532EGV89G0xuu1iBwmZIMBkhtxrJ2wjAVvPzz8OrywX3P59lfQhs WJZuat5LO/06xqF8EvlaMYSRR/23WAlsdtgk7SBtg83oKkMqKwq8+kB9VLWzzjOg+ynrLpZTeqW ISAGHAyetXeLfe9fiRf74B2tdb5HBovcwqJMwGPGhEdx+hrz6AdH61LvN4UkNThTa2QE257I= X-Received: by 2002:a05:6000:1085:: with SMTP id y5mr43869780wrw.696.1641304037665; Tue, 04 Jan 2022 05:47:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBmrZcaJLncb3QVMEMXsYQBRtDAxB0rGNPHSNp84ztfKf8Fo6N5424lQyslyMhNK9vRAL/cA== X-Received: by 2002:a05:6000:1085:: with SMTP id y5mr43869772wrw.696.1641304037468; Tue, 04 Jan 2022 05:47:17 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 1/8] util: Report error in virLogParseDefaultPriority Date: Tue, 4 Jan 2022 14:47:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 1641304071264100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/util/virlog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/virlog.c b/src/util/virlog.c index ac35e36148c6..90d3d7c5cb53 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1187,6 +1187,10 @@ virLogParseDefaultPriority(const char *priority) return VIR_LOG_WARN; else if (STREQ(priority, "4") || STREQ(priority, "error")) return VIR_LOG_ERROR; + + virReportError(VIR_ERR_INVALID_ARG, + _("Failed to set logging priority, argument '%s' is " + "invalid"), priority); return -1; } =20 --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 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=1641304050; cv=none; d=zohomail.com; s=zohoarc; b=GrFM+VbnfeBH6TUpvciwKxyA4wn7cWL1w8JUM21nqK+wRaXU3vz3GcepAPnPC/DRKVYdmHoxMASKPpLUjWHmXEl+B0btuHeUOZAWddr2iyv72/pb/YrxlfhnDLsaxaD7EkupiOFVU9gcG9QaD9SvU1tqq2P3y96YVUpLT0QJXhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304050; 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=hu7PbnMIBrZv9jtrMK7qVBM8XGtgrEEcLdK0Xwz3OiM=; b=SWd3N5cUscO/5Vp9G7e6Q+pqER3vdYl5zghoznK2p73G3i0hCDNYDHCyklfwCfvFPBWuewTtAnCH0hPuJlwmF8RJkYZlZpM+xDy/V6Im5up7E3e1EOiIDEHjt0w1WFcexrcJwHuKCb7E4qt4ooQulcQlnrHnHDGETULBsxWq3MU= 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 16413040505921016.1010249427475; Tue, 4 Jan 2022 05:47:30 -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-466-_W2cf7cPNkKos4-IjRsx6g-1; Tue, 04 Jan 2022 08:47:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8B88D102C889; Tue, 4 Jan 2022 13:47:23 +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 674201091ED3; Tue, 4 Jan 2022 13:47:23 +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 DED5D4A7C9; Tue, 4 Jan 2022 13:47:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlKHn019588 for ; Tue, 4 Jan 2022 08:47:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id D905D492CAB; Tue, 4 Jan 2022 13:47:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4BD0492CA9 for ; Tue, 4 Jan 2022 13:47:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC94128EC10E for ; Tue, 4 Jan 2022 13:47:20 +0000 (UTC) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-10-E8Lrca9RNb6sn8m5nH2Vqg-1; Tue, 04 Jan 2022 08:47:19 -0500 Received: by mail-wm1-f72.google.com with SMTP id l20-20020a05600c1d1400b003458e02cea0so17543143wms.7 for ; Tue, 04 Jan 2022 05:47:19 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id z17sm39697579wmi.22.2022.01.04.05.47.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:16 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 635152FEE73E for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304049; 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=hu7PbnMIBrZv9jtrMK7qVBM8XGtgrEEcLdK0Xwz3OiM=; b=QQ515wyxD68xLNeXmnVH1mi0IL8DqeSHiy5jOtOJBHMcGGtHlsjhIAqrqVXSJubQcA7Z0z ouc7/NjSD56ghntXdTZvQefIof25OtpUfTL39arYdDTMJnje3eiFkc1vr7ybLAV4M9ie45 ayx8zV21YRAmnVKbsAT7UgKy03IVsMo= X-MC-Unique: _W2cf7cPNkKos4-IjRsx6g-1 X-MC-Unique: E8Lrca9RNb6sn8m5nH2Vqg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hu7PbnMIBrZv9jtrMK7qVBM8XGtgrEEcLdK0Xwz3OiM=; b=tdnve67yXu+iLrLVjkQpWjotYwVDmD9+p/tvQ+rHrsPLoaN1xYPz0cF0jEQAgSuDFk OIr0+lVD61SeOFZYnW/pbHf7+6rrSKcHxYSYaZBGrLgevK32OfiBZctuyLOudFO5h9+q FVvPWvGAwNKkKafT6cL2bZbc/6N6chk1O+oufKMLXGfaYka/JmpsswLLsIHQTN0IxITP ka9Al/fBun97Y1qIKeG3i6UajQyk+OEMJ6CeLMwRPvBesJIx+P3oMTK+HKRv7b4yTFqt LkA8c6mJD5nu2ZxQXJmSIK98k3Lduz9Fxp8NV5U5PiFx0mOHghtstpXsziLbWG8ugXqF gZTg== X-Gm-Message-State: AOAM532O4S7wpZY5CVrIjnRqX6/yFlxO0YRLY//jUYAQsS7Zs2U+idbj Zolj006XiSgOFf1qqcff45E1BkNxgdMEGLh6cwgNYa4xmHq3eOjm9vycj4lq+zQnhYC78OO9mDJ sl8Utr2QJQy4jBaXinz444Uxm+qda1b7mgJ/jDwfmPEcN/QBf7IGk2ad5O4IPbta0wEFC9XU= X-Received: by 2002:a05:600c:4f46:: with SMTP id m6mr36029417wmq.19.1641304038556; Tue, 04 Jan 2022 05:47:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxq3UfKr6mDa9BQpzGNO+rns7Epq71oKz4V9ZjKTo4AyJg2Kyc7zyGEhYXDnOuCcyRAN8yRJw== X-Received: by 2002:a05:600c:4f46:: with SMTP id m6mr36029406wmq.19.1641304038352; Tue, 04 Jan 2022 05:47:18 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 2/8] util: Do not hide errors in virLogSetDefaultOutput Date: Tue, 4 Jan 2022 14:47:06 +0100 Message-Id: <607d70a1689ed9b9fa164041df2746d487afa5bf.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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.84 on 10.5.11.22 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: 1641304051784100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander --- src/util/virlog.c | 8 +++++--- src/util/virlog.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index 90d3d7c5cb53..bf791d901a24 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -201,7 +201,7 @@ virLogSetDefaultOutputToFile(const char *binary, bool p= rivileged) * according to @binary, @godaemon, @privileged. This function should be r= un * exactly once at daemon startup, so no locks are used. */ -void +int virLogSetDefaultOutput(const char *binary, bool godaemon, bool privileged) { bool have_journald =3D access("/run/systemd/journal/socket", W_OK) >= =3D 0; @@ -209,14 +209,16 @@ virLogSetDefaultOutput(const char *binary, bool godae= mon, bool privileged) if (godaemon) { if (have_journald) virLogSetDefaultOutputToJournald(); - else - virLogSetDefaultOutputToFile(binary, privileged); + else if (virLogSetDefaultOutputToFile(binary, privileged) < 0) + return -1; } else { if (!isatty(STDIN_FILENO) && have_journald) virLogSetDefaultOutputToJournald(); else virLogSetDefaultOutputToStderr(); } + + return 0; } =20 =20 diff --git a/src/util/virlog.h b/src/util/virlog.h index 460e54ba0501..a04811e4083c 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -154,7 +154,7 @@ void virLogFilterListFree(virLogFilter **list, int coun= t); int virLogSetOutputs(const char *outputs); int virLogSetFilters(const char *filters); char *virLogGetDefaultOutput(void); -void virLogSetDefaultOutput(const char *fname, bool godaemon, bool privile= ged); +int virLogSetDefaultOutput(const char *fname, bool godaemon, bool privileg= ed); =20 /* * Internal logging API --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1641304051; cv=none; d=zohomail.com; s=zohoarc; b=GGJniRzOMD2DLhU557jTNHG8y+2qjLfYYD03SpT2kg/SPdBBvIF9alZ51NmgdeIf/HPBiTGk1AYWDJv1k9Ef6pcAu5tkCAIWuPHYWJeGEnXaxuHvM6wMeCGWyK9/DFfhkaNONhCREQL3QF9J7CLqgLreV4ozHqWztkVuvXUnpsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304051; 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=U5QCU7AE7GWe7igycSvys3Y3FHrjbsQYY3h0pTcfwxc=; b=PAxI2ZOq86qNqYqfTLL75AVfr72Bsh/rk0fmnAt+8atFmaaB4yjIlrn0+CpEp8SEKtl9Vl/GropcHzyuirfkvLjmvurYYkT5JFml7hUU9BZjnljeIc1CW/t3GfqPO3r8zsqtvgP4nuh0hE9Hf5LqVD52L4y0kUuzT22PAY0IfIs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1641304051707711.6796989485549; Tue, 4 Jan 2022 05:47:31 -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-531-WotmPIxSNlyexF-xucgoIQ-1; Tue, 04 Jan 2022 08:47:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 860DD3D9F; Tue, 4 Jan 2022 13:47:23 +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 60D227E672; Tue, 4 Jan 2022 13:47:23 +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 5A85E4A7C8; Tue, 4 Jan 2022 13:47:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlJMj019580 for ; Tue, 4 Jan 2022 08:47:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id C5B44492CAB; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C14E4492CA9 for ; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7CB738035AC for ; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-tw03XmgaODaIUP2CbiPq8w-1; Tue, 04 Jan 2022 08:47:18 -0500 Received: by mail-wr1-f70.google.com with SMTP id g6-20020adfbc86000000b001a2d62be244so10430523wrh.23 for ; Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id p18sm51282646wmq.0.2022.01.04.05.47.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:15 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 641272FEE73F for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304050; 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=U5QCU7AE7GWe7igycSvys3Y3FHrjbsQYY3h0pTcfwxc=; b=bfYjDoYXUHyM4LRfyq5xwhQADSGFa6Zinim/eQIEVxH4D4GjzQ+BNawav5R61U713vcdjk gfq3usXGxNLJYjFcScqHD4LjdYX+WqylHDnUtmpIC5WhSPUmya2OqmfUg5LoLwI8YadRgN mVJOcORxcfMaaPXBtTLtDnwIydMD4RA= X-MC-Unique: WotmPIxSNlyexF-xucgoIQ-1 X-MC-Unique: tw03XmgaODaIUP2CbiPq8w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U5QCU7AE7GWe7igycSvys3Y3FHrjbsQYY3h0pTcfwxc=; b=Smbw38ltsebi8C2LuTohgLIINgoFCDZurV/g/HAB+u2Y3BwGhuh4vwsfsJUSjG4obh dROq6gkLb2rROWHsUpQb2HP++8GOi58XEt/AjSSHLhH960VTaC4xajPRzAhRRuu5Lyw+ mAiSFd8+tV+k1+u9CjA0ZL4+/OZ0N+kyWbDecSL64o6DCnZW8KXES5xOzDOBOMII9SGV E3iZVng5whmuSM5i/jDgVNlGd7p6PSSwXNDQPZwXoGZc40JLFVjgV3cZo/1fgwX7Qf7M n3VQ1MGA94g7nmZFQmXliMZTUUdWFGJatzcUCoIo9o8S589Cp8tToygLacqGTQ6m2Q0q IRjw== X-Gm-Message-State: AOAM530fLMFFvfHH7gqwi+i0CleWDYVMJuhoprsiaViSF/TfCrGCT4Tz y7CwUeClY6cgBWmvyE5dNDTXDWfdXToVlJc1J4TH2Cg32uobmN6RLNc8E3UYRZ8H0QMEaO7QCHI HfL3ObIe4YsmqpDbVCeO0ZweEGX6DYbcPwp1eztFYeFoxsWljRFBJwT94gNhkrk0o3QjzMf8= X-Received: by 2002:adf:ec83:: with SMTP id z3mr43433452wrn.165.1641304037352; Tue, 04 Jan 2022 05:47:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiOqtXhcD6R30ZbJQBk//V8E46K8AUro2mgP2fLv/0dXxQyjla/huxQJt6sgwHjw2uIlps3g== X-Received: by 2002:adf:ec83:: with SMTP id z3mr43433440wrn.165.1641304037170; Tue, 04 Jan 2022 05:47:17 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 3/8] util: Report error in virLogSetDefaultOutputToFile Date: Tue, 4 Jan 2022 14:47:07 +0100 Message-Id: <95d3cf3b173ad5d326215f2bf7b9f9ba5d9675cd.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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.11 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: 1641304054005100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/util/virlog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virlog.c b/src/util/virlog.c index bf791d901a24..e368cada6024 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -178,6 +178,7 @@ virLogSetDefaultOutputToFile(const char *binary, bool p= rivileged) old_umask =3D umask(077); if (g_mkdir_with_parents(logdir, 0777) < 0) { umask(old_umask); + virReportSystemError(errno, "%s", _("Could not create log dire= ctory")); return -1; } umask(old_umask); --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 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=1641304052; cv=none; d=zohomail.com; s=zohoarc; b=nV936wfXOVA1iVoPcFjNrNxsQGjG1frfeYOM596Wz18OHRy37pZzvZxZYSjkZJlATv4QqhxttnIhXvXcaTW1iy+qt0CtNabeE+UZfBqAj/EUY3sWcILL5HX9U7soKaO/6vpE5vg3H1wngtY9VkssQdN9vvj8RZoSGT2qNw9tAIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304052; 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=LmE9HwsuPpWTY9QL9OFvl0S51+VSo8tnQFdFQCiyG6s=; b=OrPidyhhFdtgOHNuT7gCXZNOTn+GDQNG2iTurW6pW7BOPllYOmLgnQ6LgFXMhQmQc+yB7RLQKWnGvJuiC4OBkQZ0Qg/O3Ya2uAJtaTyothQdskB+8YPUmJRMD1MCP7CuENXMMXP8RemMAHDODd7cj+8j78MfzlAbdHtS+VJzg6c= 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 1641304052422417.30054836669717; Tue, 4 Jan 2022 05:47:32 -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-480-xM0l8f_WOkW9_9XcX2ktEA-1; Tue, 04 Jan 2022 08:47:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B0498015CD; Tue, 4 Jan 2022 13:47:23 +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 3AF237E667; Tue, 4 Jan 2022 13:47:23 +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 344764CA93; Tue, 4 Jan 2022 13:47:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlJwU019575 for ; Tue, 4 Jan 2022 08:47:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 75EB61410F36; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71E02140EBFE for ; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54E9F185A79C for ; Tue, 4 Jan 2022 13:47:19 +0000 (UTC) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-444-YfAE-ai8MMOjkrGDpGjYnQ-1; Tue, 04 Jan 2022 08:47:18 -0500 Received: by mail-wm1-f71.google.com with SMTP id ay41-20020a05600c1e2900b00345a568e6b2so317667wmb.4 for ; Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id l25sm36183500wmh.18.2022.01.04.05.47.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:15 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 6E93C2FEE740 for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304051; 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=LmE9HwsuPpWTY9QL9OFvl0S51+VSo8tnQFdFQCiyG6s=; b=As/vzbBhByT9+pZIblFZDgXKQPZ6ongiPvm+pmVp2VvXK1RIaIIPbigGEso2LFdoz59koZ p/KnATqeSDG/PGKCcjdGBhF/JNaSUZXcIROqGT1nnZ7t52/F+nDFT9rMKmtgu+ITCnOEhV faxaW0nuZNGQzEj+Ec0Xlauc/wEmzoo= X-MC-Unique: xM0l8f_WOkW9_9XcX2ktEA-1 X-MC-Unique: YfAE-ai8MMOjkrGDpGjYnQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LmE9HwsuPpWTY9QL9OFvl0S51+VSo8tnQFdFQCiyG6s=; b=XD1lHN2xVE6lXgU314A5nDE/AY2Ojdq1Km8KGIJcYd4EzDxuhA+O3TnFInQhiX7sur njseF/NJT/5tbdBHKrjYtu359bpqllavBUhtWb9voLNd3r7gcE9jjNJjpwwlZ+zEYz0H +bdAmkxYZlgYj2TZowkpAjnjzuQEynjodIyPJ+HTz5GPvnLmz0cDqI6+mRiYkCwUbWRh gYOjvUlYyoYzme30U/GKtUMTr4VNt/YPXMEWenI425Tk6p/pWh4eouHB/rO7z4I0wpYu MtuOqNNUx3hC60hv7UJuHil6VbZA2MhI9aOZYCjVTFe46XUW3NgP4AtY4zS8VzWoXiNv tQUw== X-Gm-Message-State: AOAM533sXTQurSaj8RtIaLPleTUGkSiStnNBQl6Exi2mJSDr0mYpCGtM UaNHXGRMW0ke1TWEu3MKjoilVfjSbqSqD40uL8e3a9Wz4qgG6a5ZEe+DS06+b2RR/UnFEmQoNRL G3s5Sj1bQuqiGGi51sXpUphEeOGHTpfDcrqx/5CHvQwDiICfLGs7++kVbIEY0MSGWcQe/5FM= X-Received: by 2002:adf:f40b:: with SMTP id g11mr41892103wro.645.1641304037035; Tue, 04 Jan 2022 05:47:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkLOoj8YSclnqZLoF0rz2wr5R2vVFPm5qBz6ZO87kx62KwikHzuM3N/f9utGVsKNf+WYnxBQ== X-Received: by 2002:adf:f40b:: with SMTP id g11mr41892094wro.645.1641304036855; Tue, 04 Jan 2022 05:47:16 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 4/8] util: Initialize virLogMutex statically Date: Tue, 4 Jan 2022 14:47:08 +0100 Message-Id: <0c2e3c3bd317bdc432d93d76267f436cd3d8404b.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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.11 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: 1641304054179100003 Content-Type: text/plain; charset="utf-8" The only difference is that we are not going to be guaranteed that the mute= x is normal (as opposed to recursive, although there is no system known to me th= at would default to recursive mutexes), but that was done only to find occasio= nal errors (during runtime, back in 2010, commit 336fd879c00b). Functions using this mutex are mostly stable and unchanging, and it makes the virLogOnceIni= t() function only return 0 (or possibly abort in glib calls). On top of that w= e can assume that the virLogMutex is always initialized which enables us to be mo= re consistent in some early error reporting. Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/util/virlog.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index e368cada6024..5848940c6ccb 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -125,7 +125,7 @@ static void virLogOutputToFd(virLogSource *src, /* * Logs accesses must be serialized though a mutex */ -virMutex virLogMutex; +static virMutex virLogMutex =3D VIR_MUTEX_INITIALIZER; =20 void virLogLock(void) @@ -250,9 +250,6 @@ virLogPriorityString(virLogPriority lvl) static int virLogOnceInit(void) { - if (virMutexInit(&virLogMutex) < 0) - return -1; - virLogLock(); virLogDefaultPriority =3D VIR_LOG_DEFAULT; =20 --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1641304063; cv=none; d=zohomail.com; s=zohoarc; b=VT3nlZirxO4FowdEeC9FgbkiAgsEFPjPT9DufekwDjZYeI2V6fEQ7ZutfKhslWNBes71Bnigrk2uV/p6EVkYBT7MsXnIM62k+FnFcnvKaqcGrdOAb9Dpa8upc4CD0m4Pu24ouDZYSy3pLGX1NZv7FQ3lIdciNPcTfyZV0Uod0mQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304063; 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=zrjXqaIqUOctMCS37pCeAcugJq4sPZE5TpLRy0M4FkA=; b=FOcx8ArnW3xbN6+jggUF+uTUl6coza+6IwwKCnOR1fmbHYzXrN/elhltYCPO8ZDDQGM5v8A0t533c4+rslt5FTNAhqsD8dHBRJrxyONZa4k7Of4XIRRFLM0CclHswexpJHI8OY/rd20SEig653Mw2oZtkZopL9A8LG2p1ELCFLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1641304063312397.62492892752437; Tue, 4 Jan 2022 05:47:43 -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-389-N10YStVpOS6ikjSc2lSAag-1; Tue, 04 Jan 2022 08:47:40 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62D8881CCB5; Tue, 4 Jan 2022 13:47:35 +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 048482B3CA; Tue, 4 Jan 2022 13:47:35 +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 99B6A4A708; Tue, 4 Jan 2022 13:47:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlMh9019605 for ; Tue, 4 Jan 2022 08:47:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7829E492CAB; Tue, 4 Jan 2022 13:47:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73288492CA9 for ; Tue, 4 Jan 2022 13:47:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A390805BFC for ; Tue, 4 Jan 2022 13:47:22 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-3QT0RGbFNK-48m46kUTSSQ-1; Tue, 04 Jan 2022 08:47:21 -0500 Received: by mail-wr1-f69.google.com with SMTP id c16-20020adfa310000000b001a2349890e1so11675438wrb.0 for ; Tue, 04 Jan 2022 05:47:20 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id w17sm39450521wmc.14.2022.01.04.05.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 6F9372FEE741 for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304062; 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=zrjXqaIqUOctMCS37pCeAcugJq4sPZE5TpLRy0M4FkA=; b=ESVc7gjwzwLEG5ZQUJCXVCEIa89xH09opfugVOfKhUSfUfaK15lo+aP2uxzIqw/3xONX9b bYsFCDqR9ugxlXyIEwexyza9IVWMNVMVUMHbOLze55pJgWs3hYfy2JPwAfuWt1dRb1jG8L qPfyhcqmyWLhwiUaTXyC+PGtnZZWEGY= X-MC-Unique: N10YStVpOS6ikjSc2lSAag-1 X-MC-Unique: 3QT0RGbFNK-48m46kUTSSQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zrjXqaIqUOctMCS37pCeAcugJq4sPZE5TpLRy0M4FkA=; b=AMjTil4U+LGC+yGTYKbXnNNtwdP7HGOzVdhYu7rJ3aJkQNJwerABA4L0dDcPDlUyjX k5k1fQb401Kp2ArhbTIoKJfWs9Lw80NbR6Rt41VOSsHt0F1pYvaDzwM0OcRFzmeNvzO1 Iy/ueCqq268JgdNmoCCEhQLSZ4zaUZRInLFMsXzxB9BgEImm8uswpI8fKtN0SE101y9S vZDJh54sOS5rHmH0Jkm0rhN5rXLtQOlLpg5ozYzCUSPTsovaiUuSL/XIM5/nLROtqC0v q3iFAWJ4cZYo1R3YU6LNuz1UE77sg9Fr1wqBOOqW+BJCmWJh8+Pc43vWiCohWB/l+3Nk B8Qw== X-Gm-Message-State: AOAM5307JWqB6b5DUFTj4H7h6r7jaxSe7YJlPFJDNFa84Q4qvDBL1LyO sT9GCiF8vYqMUm6wNOyTNpn9pMLXb/h9kfP8O0RDQu/9yqkB2ayMEoNEIW252EbEvEQICjPTOCD TeqnyxiZ7JlGiZkkOgrbyEJRrkwGHTe3V0RclWuMZGX/KpxpOthcpU2q3ydVSvTPwfyNKiko= X-Received: by 2002:adf:d1c1:: with SMTP id b1mr41848255wrd.491.1641304039997; Tue, 04 Jan 2022 05:47:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvfXhKKqGzk47sm0SAx8ptnEDWEmWPXcu7qqbKPfl47HNeskzbnmtm/Td9hTPePtvNkn4TSw== X-Received: by 2002:adf:d1c1:: with SMTP id b1mr41848235wrd.491.1641304039769; Tue, 04 Jan 2022 05:47:19 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 5/8] Exit on errors from virDaemonSetupLogging Date: Tue, 4 Jan 2022 14:47:09 +0100 Message-Id: <578c4c445345f56fa55262b0d357077238dcac70.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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.84 on 10.5.11.23 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: 1641304064172100001 Content-Type: text/plain; charset="utf-8" This prevents starting any daemons with improper logging settings. This is desirable on its own, but will be even more beneficial when more functions = start reporting errors and failing on them, coming up in following patches Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/locking/lock_daemon.c | 15 ++++++++------- src/logging/log_daemon.c | 15 ++++++++------- src/remote/remote_daemon.c | 15 ++++++++------- src/util/virdaemon.c | 31 ++++++++++++++++++++----------- src/util/virdaemon.h | 14 +++++++------- 5 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 107fb22bc2c9..ea81940a4325 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -913,13 +913,14 @@ int main(int argc, char **argv) { } VIR_FREE(remote_config_file); =20 - virDaemonSetupLogging("virtlockd", - config->log_level, - config->log_filters, - config->log_outputs, - privileged, - verbose, - godaemon); + if (virDaemonSetupLogging("virtlockd", + config->log_level, + config->log_filters, + config->log_outputs, + privileged, + verbose, + godaemon) < 0) + exit(EXIT_FAILURE); =20 if (!pid_file && virPidFileConstructPath(privileged, diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index de6bf082e89b..fe7fa8534aec 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -719,13 +719,14 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } =20 - virDaemonSetupLogging("virtlogd", - config->log_level, - config->log_filters, - config->log_outputs, - privileged, - verbose, - godaemon); + if (virDaemonSetupLogging("virtlogd", + config->log_level, + config->log_filters, + config->log_outputs, + privileged, + verbose, + godaemon) < 0) + exit(EXIT_FAILURE); =20 if (!pid_file && virPidFileConstructPath(privileged, diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 4e10f3ad2307..8a4610da83c8 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -936,13 +936,14 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } =20 - virDaemonSetupLogging(DAEMON_NAME, - config->log_level, - config->log_filters, - config->log_outputs, - privileged, - verbose, - godaemon); + if (virDaemonSetupLogging(DAEMON_NAME, + config->log_level, + config->log_filters, + config->log_outputs, + privileged, + verbose, + godaemon) < 0) + exit(EXIT_FAILURE); =20 /* Let's try to initialize global variable that holds the host's boot = time. */ if (virHostBootTimeInit() < 0) { diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c index bb2df2eb2cab..795206301227 100644 --- a/src/util/virdaemon.c +++ b/src/util/virdaemon.c @@ -151,7 +151,7 @@ virDaemonForkIntoBackground(const char *argv0) * but if verbose or error debugging is asked for then also output * informational and debug messages. Default size if 64 kB. */ -void +int virDaemonSetupLogging(const char *daemon_name, unsigned int log_level, char *log_filters, @@ -160,7 +160,8 @@ virDaemonSetupLogging(const char *daemon_name, bool verbose, bool godaemon) { - virLogReset(); + if (virLogReset() < 0) + return -1; =20 /* * Libvirtd's order of precedence is: @@ -169,15 +170,17 @@ virDaemonSetupLogging(const char *daemon_name, * Given the precedence, we must process the variables in the opposite * order, each one overriding the previous. */ - if (log_level !=3D 0) - virLogSetDefaultPriority(log_level); + if (log_level !=3D 0 && + virLogSetDefaultPriority(log_level) < 0) + return -1; =20 /* In case the config is empty, both filters and outputs will become e= mpty, * however we can't start with empty outputs, thus we'll need to defin= e and * setup a default one. */ - ignore_value(virLogSetFilters(log_filters)); - ignore_value(virLogSetOutputs(log_outputs)); + if (virLogSetFilters(log_filters) < 0 || + virLogSetOutputs(log_outputs) < 0) + return -1; =20 /* If there are some environment variables defined, use those instead = */ virLogSetFromEnv(); @@ -185,16 +188,22 @@ virDaemonSetupLogging(const char *daemon_name, /* * Command line override for --verbose */ - if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO)) - virLogSetDefaultPriority(VIR_LOG_INFO); + if (verbose && + virLogGetDefaultPriority() > VIR_LOG_INFO && + virLogSetDefaultPriority(VIR_LOG_INFO) < 0) + return -1; =20 /* Define the default output. This is only applied if there was no set= ting * from either the config or the environment. */ - virLogSetDefaultOutput(daemon_name, godaemon, privileged); + if (virLogSetDefaultOutput(daemon_name, godaemon, privileged) < 0) + return -1; + + if (virLogGetNbOutputs() =3D=3D 0 && + virLogSetOutputs(virLogGetDefaultOutput()) < 0) + return -1; =20 - if (virLogGetNbOutputs() =3D=3D 0) - virLogSetOutputs(virLogGetDefaultOutput()); + return 0; } =20 =20 diff --git a/src/util/virdaemon.h b/src/util/virdaemon.h index d032b8ddb3b9..9ed0942d6d0e 100644 --- a/src/util/virdaemon.h +++ b/src/util/virdaemon.h @@ -58,13 +58,13 @@ VIR_ENUM_IMPL(virDaemonErr, =20 int virDaemonForkIntoBackground(const char *argv0); =20 -void virDaemonSetupLogging(const char *daemon_name, - unsigned int log_level, - char *log_filters, - char *log_outputs, - bool privileged, - bool verbose, - bool godaemon); +int virDaemonSetupLogging(const char *daemon_name, + unsigned int log_level, + char *log_filters, + char *log_outputs, + bool privileged, + bool verbose, + bool godaemon); =20 int virDaemonUnixSocketPaths(const char *sock_prefix, bool privileged, --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 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=1641304065; cv=none; d=zohomail.com; s=zohoarc; b=RwMsBXa1KLKvBlXRrTzIuR0ilAncmcuzz97ww5szA05naqizEqTdd+wjONZKv854sSgqEXpQ47YgAZqLb3WbM6Gmz/yY3wHEOb3cXY09qThqPp54312UHabuae4ilS1VqmALQobNFDr+KEEwZrLl2O9SdInSrR16zZOS84+nRFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304065; 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=ZXK0riSFH3Y4/as1h/8SanSAD9G7BoIUcHQRMPsk0Ls=; b=lcqSmp5Svhn1XMFooiAbFcrOcUkY9l7KesfCT5yCjqzPOak1DE3pps4JfK2QVsPrrLeDENV7K8ysdAeIzJQ3Q9BbvAl3GbrNQDoLm3BrYIvvvycu0DxaH1hh5GgMkaI7zMxoTo7KxJsh4MpEhYCYQpxb5XLD4qH9khU7rwGRs5w= 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 1641304065512116.8133804725885; Tue, 4 Jan 2022 05:47:45 -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-612--v4Zox0iONqgcki86KS_Bg-1; Tue, 04 Jan 2022 08:47:43 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9470081CCBA; Tue, 4 Jan 2022 13:47:38 +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 6E2F42B4CF; Tue, 4 Jan 2022 13:47:38 +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 3C0144A709; Tue, 4 Jan 2022 13:47:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlVb7019657 for ; Tue, 4 Jan 2022 08:47:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id C3141401E39; Tue, 4 Jan 2022 13:47:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF4EC515990 for ; Tue, 4 Jan 2022 13:47:31 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4DE98001EA for ; Tue, 4 Jan 2022 13:47:31 +0000 (UTC) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-47-pAJD22_oMsWA8LQq8XHIiA-1; Tue, 04 Jan 2022 08:47:30 -0500 Received: by mail-wr1-f72.google.com with SMTP id x20-20020adfbb54000000b001a0d044e20fso11811032wrg.11 for ; Tue, 04 Jan 2022 05:47:30 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id w17sm39450523wmc.14.2022.01.04.05.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 7105F2FEE742 for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304064; 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=ZXK0riSFH3Y4/as1h/8SanSAD9G7BoIUcHQRMPsk0Ls=; b=hoFlplHTHwKTzjTUXBTgIWTnfyI8AyZTWYVVU11D918WChfZLXl3sbvgw2Zrv0K7DBzvJV JlVzjffD1C4x878HkoWEkuEBgEUP1Jr50SYLmuYZ4T5QXkBC4EGBkDFlD/gCd6ivrFvVbj CS4++tsMVE2An3xdUACCTAJMjiGsoUY= X-MC-Unique: -v4Zox0iONqgcki86KS_Bg-1 X-MC-Unique: pAJD22_oMsWA8LQq8XHIiA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZXK0riSFH3Y4/as1h/8SanSAD9G7BoIUcHQRMPsk0Ls=; b=pIyouo4X7Ak65/rLEi0AfaMMixyBvP89RgLLECWdqDcZsBDXxhgvZwobrxpXnfrq1i 0iAL8zShU+r64wAUpteLM+girpqrMb3Zk323AWpQE8G9sqa0eKlOu6XIVFeMM83N6KHt huFspYK0KU2IvHi8/KwBcSJYRq0WiJebGFVvuBBANPvBgg9IoM06u3OOLbRcaJ7KBLJS 40tNpJS/Rd2HMhJ0wKUVNqTLb2acpxW+eBHxHkbEYjtTPhOy848iKzFMkKC29uS8uO1g ERr9Z4Toa2EGf04jL8nWiyzqf4rYQTlZAvpOkwVsA+HxBuZynrhHMVICqn0hSA3Wnc4L e+Kw== X-Gm-Message-State: AOAM5332xtiTL73+Lik6xYsvreRqCu5MUTz0HjgnFMtVQq8/Kv4EoocY ZZjhhOXEcmqDk/Ul2YzOGoHCK51dw6v2UMN1i5zWPetIbD4O36riSdeLV6w/HwM/wO/DnHr4NqC 1Jczoxudjgvymbc/X8UmyWdQTpKGALEoFVCpdr/YtrLCjMlxtNJYN3hi0gqabejkONM2zTJY= X-Received: by 2002:adf:fc02:: with SMTP id i2mr42368749wrr.154.1641304049301; Tue, 04 Jan 2022 05:47:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkM80lbU3dwLWc8d7uSxanmoywqJpJ/Cq6B4awudCvwk0j01OukGeis5u1Cjx+wp/rs7sCag== X-Received: by 2002:adf:fc02:: with SMTP id i2mr42368730wrr.154.1641304048969; Tue, 04 Jan 2022 05:47:28 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 6/8] util: Check for errors in virLogSetFromEnv Date: Tue, 4 Jan 2022 14:47:10 +0100 Message-Id: <21ddc3e476fb99d8c73f630b47cb982e164fd87b.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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.84 on 10.5.11.23 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: 1641304066464100005 Content-Type: text/plain; charset="utf-8" And make callers check the return value as well. This helps error out earl= y for invalid environment variables. That is desirable because it could lead to deadlocks. This can happen when resetting logging after fork() reports translated errors because gettext functions are not reentrant. Well, it is not limited to resetting logging = after fork(), it can be any translation at that phase, but parsing environment variables is easy to make fail on purpose to show the result, it can also h= appen just due to a typo. Logging settings are also something that we want to re= port errors on for example when it is being done over admin API. Before this commit it is possible to deadlock the daemon on startup with something like: LIBVIRT_LOG_FILTERS=3D'1:*' LIBVIRT_LOG_OUTPUTS=3D1:stdout libvirtd where filters are used to enable more logging and hence make the race less = rare and outputs are set to invalid Combined with the previous patches this changes the following from: ... to: ... libvirtd: initialisation failed The error message is improved in future commits and is also possible thanks= to this patch. Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/admin/libvirt-admin.c | 3 ++- src/libvirt.c | 3 ++- src/lxc/lxc_controller.c | 3 ++- src/remote/remote_ssh_helper.c | 3 ++- src/security/virt-aa-helper.c | 3 ++- src/util/vircommand.c | 3 ++- src/util/virdaemon.c | 3 ++- src/util/virlog.c | 26 ++++++++++++++++++-------- src/util/virlog.h | 2 +- tests/testutils.c | 4 +++- 10 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/admin/libvirt-admin.c b/src/admin/libvirt-admin.c index a3164a2395cf..01546a7bc270 100644 --- a/src/admin/libvirt-admin.c +++ b/src/admin/libvirt-admin.c @@ -55,7 +55,8 @@ virAdmGlobalInit(void) if (virErrorInitialize() < 0) goto error; =20 - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + goto error; =20 #ifdef WITH_LIBINTL_H if (!bindtextdomain(PACKAGE, LOCALEDIR)) diff --git a/src/libvirt.c b/src/libvirt.c index ef9fc403d083..35fd74fe08da 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -232,7 +232,8 @@ virGlobalInit(void) goto error; } =20 - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + goto error; =20 virNetTLSInit(); =20 diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 67ebed361ae0..3c930eaacdee 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -2503,7 +2503,8 @@ int main(int argc, char *argv[]) } =20 /* Initialize logging */ - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + exit(EXIT_FAILURE); =20 while (1) { int c; diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c index 4f4dbff7d0ad..78f02020a745 100644 --- a/src/remote/remote_ssh_helper.c +++ b/src/remote/remote_ssh_helper.c @@ -402,7 +402,8 @@ int main(int argc, char **argv) virFileActivateDirOverrideForProg(argv[0]); =20 /* Initialize the log system */ - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + exit(EXIT_FAILURE); =20 uri_str =3D argv[1]; VIR_DEBUG("Using URI %s", uri_str); diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index b7ffb5e2c324..28717b7e38b8 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1449,7 +1449,8 @@ main(int argc, char **argv) virFileActivateDirOverrideForProg(argv[0]); =20 /* Initialize the log system */ - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + exit(EXIT_FAILURE); =20 /* clear the environment */ environ =3D NULL; diff --git a/src/util/vircommand.c b/src/util/vircommand.c index ba5a2090768b..3b8c1c65c160 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -751,7 +751,8 @@ virExec(virCommand *cmd) VIR_FORCE_CLOSE(null); =20 /* Initialize full logging for a while */ - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + goto fork_error; =20 if (cmd->pidfile && virPipe(pipesync) < 0) diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c index 795206301227..5c0ca534cf16 100644 --- a/src/util/virdaemon.c +++ b/src/util/virdaemon.c @@ -183,7 +183,8 @@ virDaemonSetupLogging(const char *daemon_name, return -1; =20 /* If there are some environment variables defined, use those instead = */ - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + return -1; =20 /* * Command line override for --verbose diff --git a/src/util/virlog.c b/src/util/virlog.c index 5848940c6ccb..71913a2997f4 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1200,24 +1200,34 @@ virLogParseDefaultPriority(const char *priority) * * Sets virLogDefaultPriority, virLogFilters and virLogOutputs based on * environment variables. + * + * This function might fail which should also make the caller fail. */ -void +int virLogSetFromEnv(void) { const char *debugEnv; =20 if (virLogInitialize() < 0) - return; + return -1; =20 debugEnv =3D getenv("LIBVIRT_DEBUG"); - if (debugEnv && *debugEnv) - virLogSetDefaultPriority(virLogParseDefaultPriority(debugEnv)); + if (debugEnv && *debugEnv) { + int priority =3D virLogParseDefaultPriority(debugEnv); + if (priority < 0 || + virLogSetDefaultPriority(priority) < 0) + return -1; + } debugEnv =3D getenv("LIBVIRT_LOG_FILTERS"); - if (debugEnv && *debugEnv) - virLogSetFilters(debugEnv); + if (debugEnv && *debugEnv && + virLogSetFilters(debugEnv)) + return -1; debugEnv =3D getenv("LIBVIRT_LOG_OUTPUTS"); - if (debugEnv && *debugEnv) - virLogSetOutputs(debugEnv); + if (debugEnv && *debugEnv && + virLogSetOutputs(debugEnv)) + return -1; + + return 0; } =20 =20 diff --git a/src/util/virlog.h b/src/util/virlog.h index a04811e4083c..4f755c543b78 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -146,7 +146,7 @@ char *virLogGetFilters(void); char *virLogGetOutputs(void); virLogPriority virLogGetDefaultPriority(void); int virLogSetDefaultPriority(virLogPriority priority); -void virLogSetFromEnv(void); +int virLogSetFromEnv(void) G_GNUC_WARN_UNUSED_RESULT; void virLogOutputFree(virLogOutput *output); void virLogOutputListFree(virLogOutput **list, int count); void virLogFilterFree(virLogFilter *filter); diff --git a/tests/testutils.c b/tests/testutils.c index 65f02e023199..322c3b94004c 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -835,7 +835,9 @@ int virTestMain(int argc, if (virErrorInitialize() < 0) return EXIT_FAILURE; =20 - virLogSetFromEnv(); + if (virLogSetFromEnv() < 0) + return EXIT_FAILURE; + if (!getenv("LIBVIRT_DEBUG") && !virLogGetNbOutputs()) { if (!(output =3D virLogOutputNew(virtTestLogOutput, virtTestLogClo= se, &testLog, VIR_LOG_DEBUG, --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 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=1641304071; cv=none; d=zohomail.com; s=zohoarc; b=G7XzE/YXWHF3EBcEbYcPu4+7wN/VMZflLxHrCCj6YItpNLqLPR9I29fs5AkFcalKOmgzEJuWSRKqTYdEVUxPJnNqqt+W0PQy8o/GRyBxUEP4k+zmxKMvgO4o+wpBKhHbEfwnkCH9T0mG7kH5Pewqw19rnFLmzRpMXSObvDqsWfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304071; 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=UWbIjWKh82G8h2JQ2jjk7ttZifQatU/QPmWwGiAGOFA=; b=ZAJCovkA3Ffan90pVKNzZXSFsVJ/dct6gxmL/NEi88VH3dN8VH6lMusP0eDVY+uYfDTyNpUmU+elD3EphA/sx4syXxkgPqdGh7pb51kOZVkdkWBUDWFpVw/BdeYoqay3zTUKCRSu47SX81toyMZ+fTdmrBwjSgsDIELg/zfOspk= 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 1641304071276767.0094841953843; Tue, 4 Jan 2022 05:47:51 -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-232-jzHtzQmXPeqLZVuDoGti3g-1; Tue, 04 Jan 2022 08:47:48 -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 5A65C1932481; Tue, 4 Jan 2022 13:47:44 +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 33C878795A; Tue, 4 Jan 2022 13:47:44 +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 01850180BAAE; Tue, 4 Jan 2022 13:47:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlOfg019625 for ; Tue, 4 Jan 2022 08:47:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 678C4112132E; Tue, 4 Jan 2022 13:47:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6335A1121324 for ; Tue, 4 Jan 2022 13:47:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4BBE428EC109 for ; Tue, 4 Jan 2022 13:47:24 +0000 (UTC) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-SvLXi-X9NlO0mh5hUpHl_Q-1; Tue, 04 Jan 2022 08:47:20 -0500 Received: by mail-wm1-f71.google.com with SMTP id m9-20020a05600c4f4900b0034644da3525so317963wmq.3 for ; Tue, 04 Jan 2022 05:47:20 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id i8sm38409640wmq.4.2022.01.04.05.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 7C5EC2FEE743 for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304070; 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=UWbIjWKh82G8h2JQ2jjk7ttZifQatU/QPmWwGiAGOFA=; b=IivYhrjD5GuN6PPzUOryeADM0XNL7v/TEY5wW2Qo/DnFyRYP2mPzwa5XGkC2NJ7z2ZX+KP ApGVPwAWpscHAD0wcSKCqd6ToA0E9H70HEdTc/opksXqc+FgMXJ5gG7PY0qaIhtpjSW/vQ ZoikfPOdBTjaJG/5dAZ5IcrJG53eKSM= X-MC-Unique: jzHtzQmXPeqLZVuDoGti3g-1 X-MC-Unique: SvLXi-X9NlO0mh5hUpHl_Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UWbIjWKh82G8h2JQ2jjk7ttZifQatU/QPmWwGiAGOFA=; b=Q2vbA4K/Il4QrWqgAy3LipxYJpohmRvf+pybK0ujN5nogNSa4t0mGITrx8p7wVveFI dyKCQQtUVj2LsOcbaNR+WhFK4vNiKFbdNMtXzR1V2TXPu6bh/DZ76fGlfGIzTcGQth4X Byg0mPjIAVVzDdQF5M592Z5FI5aqSfmFW9wav6SWBNXk07g1o2lZS4jrH7j57P/1UtwL oB/wAAcPFeR393axQzlk3mZqHL+kG9x+nBolCQZrVVy9fnoMYPhVK/GxBqvya02d2udO T2xms5FCwGdIzsGKWFgGEx5T5gG+N//vF1+wVFruQ5/l/TXPysE+TpV8zrl7ntqaEgFd 3KKQ== X-Gm-Message-State: AOAM533LlhU/ZqhjdIi+pgFDfVEAIe7KTqbVDuev9kMENVqrkd5ovWO4 F7KB701jCpo3M9rIhFkcCAfRbUOcTqy551aNrmU4Jo8K+KcloxPMeP59ZGqUH05q41wCL3Sifzy 8OODrqVaxpJiqSdvV5AsjHm4DOpQHrkMWbkrOMzo5+j19LLCKhO0SB9hdII2b8yZZYAc4REk= X-Received: by 2002:adf:de03:: with SMTP id b3mr15803026wrm.448.1641304039411; Tue, 04 Jan 2022 05:47:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8dnu8Kb5RzWuZd+S5++ii8wuHzSb1SDCGVP2SIHjar+xRPasb/NcWxKKBPkyojZznJ19lpQ== X-Received: by 2002:adf:de03:: with SMTP id b3mr15803009wrm.448.1641304039144; Tue, 04 Jan 2022 05:47:19 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 7/8] Dispatch error in virInitialize Date: Tue, 4 Jan 2022 14:47:11 +0100 Message-Id: <77d81d691af1c67f8d54c20219ba1488e7cba719.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.13 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: 1641304073560100005 Content-Type: text/plain; charset="utf-8" Callers that already do this anyway can be cleaned up thanks to this and th= e one that does not (daemon startup) gains the benefit of the error being printed= to standard error output changing: LIBVIRT_LOG_OUTPUTS=3D1:invalid libvirtd /home/nert/dev/libvirt/upstream/build/src/libvirtd: initialisation failed into: LIBVIRT_LOG_OUTPUTS=3D1:invalid libvirtd libvirt: error : invalid argument: Invalid destination 'invalid' for outpu= t '1:invalid' /home/nert/dev/libvirt/upstream/build/src/libvirtd: initialisation failed Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/libvirt.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index 35fd74fe08da..45315f484c97 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -309,11 +309,12 @@ virGlobalInit(void) int virInitialize(void) { - if (virOnce(&virGlobalOnce, virGlobalInit) < 0) + if (virOnce(&virGlobalOnce, virGlobalInit) < 0 || + virGlobalError) { + virDispatchError(NULL); return -1; + } =20 - if (virGlobalError) - return -1; return 0; } =20 @@ -1200,18 +1201,15 @@ virConnectOpen(const char *name) virConnectPtr ret =3D NULL; =20 if (virInitialize() < 0) - goto error; + return NULL; =20 VIR_DEBUG("name=3D%s", NULLSTR(name)); virResetLastError(); ret =3D virConnectOpenInternal(name, NULL, 0); if (!ret) - goto error; - return ret; + virDispatchError(NULL); =20 - error: - virDispatchError(NULL); - return NULL; + return ret; } =20 =20 @@ -1236,18 +1234,14 @@ virConnectOpenReadOnly(const char *name) virConnectPtr ret =3D NULL; =20 if (virInitialize() < 0) - goto error; + return NULL; =20 VIR_DEBUG("name=3D%s", NULLSTR(name)); virResetLastError(); ret =3D virConnectOpenInternal(name, NULL, VIR_CONNECT_RO); if (!ret) - goto error; + virDispatchError(NULL); return ret; - - error: - virDispatchError(NULL); - return NULL; } =20 =20 @@ -1276,18 +1270,14 @@ virConnectOpenAuth(const char *name, virConnectPtr ret =3D NULL; =20 if (virInitialize() < 0) - goto error; + return NULL; =20 VIR_DEBUG("name=3D%s, auth=3D%p, flags=3D0x%x", NULLSTR(name), auth, f= lags); virResetLastError(); ret =3D virConnectOpenInternal(name, auth, flags); if (!ret) - goto error; + virDispatchError(NULL); return ret; - - error: - virDispatchError(NULL); - return NULL; } =20 =20 --=20 2.34.1 From nobody Tue May 7 18:56:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1641304065; cv=none; d=zohomail.com; s=zohoarc; b=GDzJkj0BBcnIVAwK1Oe5GAPk2kIK9PMRWuhE+SAGOGkRgD/O8fczbyG2FPKe6OSWiGq61rIlE3p186YmQqqX+vPL4/XjjEcHV0YrxA4ETimqgjF8iRfaeJo+kt9qcsmeDYsciWqXdibB9V0B80qGdrcF44aLY5Ssxc6NX3kCV60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641304065; 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=AxNtBR3QbTH8t061JzyRqjM00+iftwUmIzyodr0zays=; b=I6Le8jyXhzlTEziTczWY63lWeGenWlVmpmaVly6KuemDmx+Aym9t99yLJaqQ7yGyS25PWXRx7/ronwuskeUlzolO2zJDtfbIq+w9hhnjqXbpJZC4H3jLfAHkNQn1GrQy5mUTpGyzFVVe80drG0nmP6ExTFMoUM9TqwB06E3L6fw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1641304065113900.1037957718629; Tue, 4 Jan 2022 05:47:45 -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-107-u1urf5IrPomcocwzH0FaEA-1; Tue, 04 Jan 2022 08:47:42 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 966D0802C98; Tue, 4 Jan 2022 13:47:35 +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 669222B4B6; Tue, 4 Jan 2022 13:47:35 +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 0AF721809CB9; Tue, 4 Jan 2022 13:47:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204DlOev019615 for ; Tue, 4 Jan 2022 08:47:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id ED32F2166B41; Tue, 4 Jan 2022 13:47:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E81D02166B2F for ; Tue, 4 Jan 2022 13:47:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D56B61064E6A for ; Tue, 4 Jan 2022 13:47:21 +0000 (UTC) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-kZr75ACUNeqPZdU1Npvf5w-1; Tue, 04 Jan 2022 08:47:20 -0500 Received: by mail-wr1-f72.google.com with SMTP id s23-20020adf9797000000b001a24674f0f7so11743703wrb.9 for ; Tue, 04 Jan 2022 05:47:20 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id j13sm43326794wmq.11.2022.01.04.05.47.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 05:47:18 -0800 (PST) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 7D58F2FEE744 for ; Tue, 4 Jan 2022 14:47:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641304064; 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=AxNtBR3QbTH8t061JzyRqjM00+iftwUmIzyodr0zays=; b=ZjYkYar/Kc46G51We9jOM+qoBhkJzLv2rGyylPKu+v8fxDXdPlWtML/B6uYRcmYbzOlNZy 7ieIf5M9H42Zo0vTknpKLq/fNqCDv3FUk2B6OmyQPTzJdupLfRJjaCnKnrCJuy75r9vynA CZu1uw0HUUbo0Y3tv0uKuK1OCgjIigI= X-MC-Unique: u1urf5IrPomcocwzH0FaEA-1 X-MC-Unique: kZr75ACUNeqPZdU1Npvf5w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AxNtBR3QbTH8t061JzyRqjM00+iftwUmIzyodr0zays=; b=v3xxhfhGHJEXGJzlkhs3QKQxPnEux41pRKLhdB0Qoi3aOG1T58crhjBKXiNtUHZGID 8qBkkvtWth++L2q40KqRoDeF/Ma0xiiKMxfN0UA6JhHdBC3hKJw6gbZVWZeb9IvAYo44 X3CCU66OrytRuod5hJGmUntfbSrxalNbxNKb6hr8nH63qTb0moXYpeNZVwk9WgFpqb2H kuHmy/MQ07b1+sCcBWsH4TGEXBAGp37SwZxPxBcwo9tRIXlwXspBMtTh5xi1IeSNIZKF YRMeNUE3mTmEsxeUcYDliP5LQVb5ifpWpQYBGAo4PSPSPUSuhO7jpRVVEUxa+jX03CYy S5KQ== X-Gm-Message-State: AOAM533dPch7b5fR47LwCh9zHnRjNQmrqE2AA82lEFjNBK0ba/ELxoyC Kc2WcAee5PK+NMhK0YxNU/OSJ76QO28RQWG+zYDoYbVG5D6XqmzE5zkj59sUwHS0hEL3z9MhGyx YDTSqKEIwdAo7AID+4cTGDANRGWZtLFAxbBI89WgBMdCtpX3NiM5W1dZxjPT44kuiUFLnfzs= X-Received: by 2002:a5d:6d05:: with SMTP id e5mr42405397wrq.46.1641304039581; Tue, 04 Jan 2022 05:47:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrLRozME8HZC+BwUwDrtqj+Lm6cgrTaFu37ibiyoLXGfbIRS6OcoRH+jUBV7BhwAye0gcrjQ== X-Received: by 2002:a5d:6d05:: with SMTP id e5mr42405390wrq.46.1641304039365; Tue, 04 Jan 2022 05:47:19 -0800 (PST) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 8/8] Do not print error in remote_daemon.c:main Date: Tue, 4 Jan 2022 14:47:12 +0100 Message-Id: <1e74059c99223d4f43dd6d28dd8e5b17eae08593.1641303832.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.84 on 10.5.11.23 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: 1641304066382100003 Content-Type: text/plain; charset="utf-8" There is no need to do that since both fallible functions do that already. Signed-off-by: Martin Kletzander Reviewed-by: Erik Skultety --- src/remote/remote_daemon.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 8a4610da83c8..84157e6cc19a 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -826,10 +826,8 @@ int main(int argc, char **argv) { }; =20 if (virGettextInitialize() < 0 || - virInitialize() < 0) { - fprintf(stderr, _("%s: initialization failed\n"), argv[0]); + virInitialize() < 0) exit(EXIT_FAILURE); - } =20 virUpdateSelfLastChanged(argv[0]); =20 --=20 2.34.1