From nobody Sun Feb 8 16:05:52 2026 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