From nobody Mon Feb 9 20:10:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1576749943; cv=none; d=zohomail.com; s=zohoarc; b=C+NYp+YuJnXc4OMHwtLX7i6xkUi77DetAmvr0NTSU1T54nS+vPKeNAyfcU2vQv9QxwUeiCWRaAxxw61VPo/uHPA1st/khc1rNiwIWUXONwqhadLZRtSnN0LtpyBzqhLH5XVZzE6g7jgOU/vnbhDDucr9sSJwyANpbzYRXLfE7Cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576749943; h=Content-Type:Content-Transfer-Encoding:Cc: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=1pDV95jcnpWRslr/wleQZvXR77TLBHXF7kn5XfFgMS8=; b=mNdrK6kDO9dOAx7bKtO7m7yo7nwdT9iDIv4+NLv1qNriOp8BXSxFtOrULEXMv2sJoMbIZAthnwIIBCgQkaknetZJgeEkyJJYaiovYmwXfKckhQh8gQ1J89IeAhCTTXr/8c7OVOdftSOMwvf+5afXdyCpBKVwUOrOvoEl/KmOfFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157674994380518.818388173422136; Thu, 19 Dec 2019 02:05:43 -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-156-lSSWKzFWNYuJjGNAUZFXtg-1; Thu, 19 Dec 2019 05:05:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17E38801E78; Thu, 19 Dec 2019 10:05:33 +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 E4B425C3FD; Thu, 19 Dec 2019 10:05:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A34E9180880C; Thu, 19 Dec 2019 10:05:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBJA56HN010871 for ; Thu, 19 Dec 2019 05:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id DA4D926E48; Thu, 19 Dec 2019 10:05:06 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39CE326DF9; Thu, 19 Dec 2019 10:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576749942; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=1pDV95jcnpWRslr/wleQZvXR77TLBHXF7kn5XfFgMS8=; b=VY4xsiYFTp6vzdkuh+p5IMc3Thcr5xy8D/UfSC1xCkMkJdVEuZTsOYgErmhChAyaxegAOn bxj/hHTA3XrYuWH1tiEA1QoZ+9cSQCK8in8cQzUUT4PbfdIu+t8V/TFR1Bm8prXAhCXJcN eLSdCDX+lhuyoC/iFv9T26jQYBA+Emc= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 19 Dec 2019 11:04:18 +0100 Message-Id: <20191219100447.210836-14-fidencio@redhat.com> In-Reply-To: <20191219100447.210836-1-fidencio@redhat.com> References: <20191219100447.210836-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 13/42] util: Use g_autofree on virLogSetDefaultOutputToFile() 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.16 X-MC-Unique: lSSWKzFWNYuJjGNAUZFXtg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Fabiano Fid=C3=AAncio Reviewed-by: J=C3=A1n Tomko --- src/util/virlog.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index d45e2dd316..10639d7328 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -173,8 +173,7 @@ virLogSetDefaultOutputToJournald(void) static int virLogSetDefaultOutputToFile(const char *binary, bool privileged) { - int ret =3D -1; - char *logdir =3D NULL; + g_autofree char *logdir =3D NULL; mode_t old_umask; =20 if (privileged) { @@ -182,12 +181,12 @@ virLogSetDefaultOutputToFile(const char *binary, bool= privileged) virLogDefaultPriority, LOCAL= STATEDIR, binary); } else { if (!(logdir =3D virGetUserCacheDirectory())) - goto cleanup; + return -1; =20 old_umask =3D umask(077); if (virFileMakePath(logdir) < 0) { umask(old_umask); - goto cleanup; + return -1; } umask(old_umask); =20 @@ -195,10 +194,7 @@ virLogSetDefaultOutputToFile(const char *binary, bool = privileged) virLogDefaultPriority, logdi= r, binary); } =20 - ret =3D 0; - cleanup: - VIR_FREE(logdir); - return ret; + return 0; } =20 =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list