From nobody Tue May 7 15:28:16 2024 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=1576686399; cv=none; d=zohomail.com; s=zohoarc; b=MXZOMw7wWlpHFUpGLokPevQHRVNR3A4fH4MBwnNw7Y78MZbXcYtwZf8jJ/e7AzxiLPmvIAQKHo3bisVRQkm6vGPzi595+KeKOawTg3mzzRoRooVVwoFS8KTW/TTuNOyTazAZnvnzt17VIoUWr0z0WDArsXbgtqatI7NWSleyzX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576686399; 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=Y7MbE3mE27OV7438mm+S33ytvxEaVAxdHrsb4bIYTwo=; b=h+28QtM6wHLeFrvXbrK/N5FCVTwIokD5gd+yepxGOOtrIHbIZXY91tzRFNB3e9EEzXtoeTcWJepFbE6upJjzp5lWKbYL3jZ7iUe5LIn4Nwe31BkwWgNCzfuNVd/il5L+My7viF2e0i75h4V8e2TWQI9AFAuoqzmRGErkMBjfzu4= 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 1576686399631340.21511701644033; Wed, 18 Dec 2019 08:26:39 -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-322-FFoPGWzAPeCZjmQZor_RCg-1; Wed, 18 Dec 2019 11:26:34 -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 998C518557C7; Wed, 18 Dec 2019 16:26:29 +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 6AC275C1D4; Wed, 18 Dec 2019 16:26:29 +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 C7261827D2; Wed, 18 Dec 2019 16:26:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBIGQPle012481 for ; Wed, 18 Dec 2019 11:26:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 95B8E5C28C; Wed, 18 Dec 2019 16:26:25 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E96895C1D4; Wed, 18 Dec 2019 16:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576686397; 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=Y7MbE3mE27OV7438mm+S33ytvxEaVAxdHrsb4bIYTwo=; b=Rs0qHaDrON4QtzDhZu1XCY3ANzbBufTTtOFrdI/YSkvpLmeQSV7Q81bzWW/mSXTdmXfEo7 KKlx/I227ShDC8QER5nSj6E+PEOsHxRVpDFTEnvwhVYaPLlRqfdaTz2zkpcgfyhQT1yR38 cqEuZqDMNeHju/E+9qUnsrnTDr0XGgY= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 17:26:11 +0100 Message-Id: <20191218162614.1639879-2-fidencio@redhat.com> In-Reply-To: <20191218162614.1639879-1-fidencio@redhat.com> References: <20191218162614.1639879-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v4 1/4] util: Rewrite virGetUserDirectory() using g_get_home_dir() 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: FFoPGWzAPeCZjmQZor_RCg-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: Cole Robinson --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index ed1f696e37..7008c3119c 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -582,7 +582,7 @@ virGetHostnameQuiet(void) char * virGetUserDirectory(void) { - return virGetUserDirectoryByUID(geteuid()); + return g_strdup(g_get_home_dir()); } =20 =20 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 15:28:16 2024 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=1576686408; cv=none; d=zohomail.com; s=zohoarc; b=c9NIkMmbHOKhEAE0iBWZrVUNze+FLcotTt/NDq5ZMaDju86Hh+9kniiSbIPbPg0iQK5GcDh5+ReXX3oFlnQwKfH2L5jI/qgLj27vcz58TRMPgwZbeKstS99F3fISEYs7zC1Yg3g8KlX3nTvmXLDVAYQr8+2pzcRy+0GtNjnxaDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576686408; 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=IhGXmFqg/Cg18Wx/bceh0FUtz2M0niK5gndmXq+bUA4=; b=kidxPHS0v+YdsuXuVdCuhhqY+dzdBYftCKTZLZqkvxkwUYFwRACFroM+6g492pgTHDraZnovgl3ncewOpqt0gC7zLwuqcgzwEwVoje4Ga/rR9PZz55VhCLJlPbRcuMyhlfevem1Au3SA+TQb3jwV+fHC5dfbd/MOtKheQxsxXuQ= 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1576686408947946.6996510110885; Wed, 18 Dec 2019 08:26:48 -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-154-pLI5ZvEBPGCauRTY8eNt_A-1; Wed, 18 Dec 2019 11:26:45 -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 92A5C100551B; Wed, 18 Dec 2019 16:26:37 +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 6A59E1000322; Wed, 18 Dec 2019 16:26:37 +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 EF7681803C32; Wed, 18 Dec 2019 16:26:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBIGQQOp012487 for ; Wed, 18 Dec 2019 11:26:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8DE525C28C; Wed, 18 Dec 2019 16:26:26 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2C025C1D4; Wed, 18 Dec 2019 16:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576686407; 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=IhGXmFqg/Cg18Wx/bceh0FUtz2M0niK5gndmXq+bUA4=; b=Ayt5Cch5FFgUd2HM+yeO/CmlsFz4u6SdDe52kvLUyKkDSfuYvGRS//utzCeVAmLwJYjWzQ cB6ISIdOGdFjP+0SV0/rGYs8FuaLvp0ddXV4tJeN1DWbksGqHh/1Qr5yx1VmFHeX5mKp/x Jz26AyV2tZ+ZqHljQ+pNsyUtCRQJOuU= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 17:26:12 +0100 Message-Id: <20191218162614.1639879-3-fidencio@redhat.com> In-Reply-To: <20191218162614.1639879-1-fidencio@redhat.com> References: <20191218162614.1639879-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v4 2/4] util: Rewrite virGetUserConfigDirectory() using g_get_user_config_dir() 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 X-MC-Unique: pLI5ZvEBPGCauRTY8eNt_A-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: Cole Robinson --- src/util/virutil.c | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 7008c3119c..9d98b0051a 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -586,6 +586,16 @@ virGetUserDirectory(void) } =20 =20 +char *virGetUserConfigDirectory(void) +{ +#ifdef WIN32 + return g_strdup(g_get_user_config_dir()); +#else + return g_build_filename(g_get_user_config_dir(), "libvirt", NULL); +#endif +} + + #ifdef HAVE_GETPWUID_R /* Look up fields from the user database for the given user. On * error, set errno, report the error if not instructed otherwise via @qui= et, @@ -754,11 +764,6 @@ static char *virGetXDGDirectory(const char *xdgenvname= , const char *xdgdefdir) return ret; } =20 -char *virGetUserConfigDirectory(void) -{ - return virGetXDGDirectory("XDG_CONFIG_HOME", ".config"); -} - char *virGetUserCacheDirectory(void) { return virGetXDGDirectory("XDG_CACHE_HOME", ".cache"); @@ -1187,21 +1192,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } =20 -char * -virGetUserConfigDirectory(void) -{ - char *ret; - if (virGetWin32SpecialFolder(CSIDL_LOCAL_APPDATA, &ret) < 0) - return NULL; - - if (!ret) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine config directory")); - return NULL; - } - return ret; -} - char * virGetUserCacheDirectory(void) { @@ -1242,15 +1232,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } =20 -char * -virGetUserConfigDirectory(void) -{ - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virGetUserConfigDirectory is not available")); - - return NULL; -} - char * virGetUserCacheDirectory(void) { --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 15:28:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576686409; cv=none; d=zohomail.com; s=zohoarc; b=G7eHOpVloCW2UDqQwp4KVtT8uGm7NMA7EKFs64wmfMoGYC7lnFoL9xZUn/YZJZLi80MpKOq5HCAIWKzs6wWpyttYE8wUE+dlxZqHK/Q+Qz8PZZ0AHZvP936Zbq+7JINkev78GL9yYRE50ZjbwvIxWXdkCKqAE1bUXaY/w9xFjp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576686409; 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=BVK0yIiUXvFpkUhtPtV7CW75H81vczfCz1CIZdnte+U=; b=j7K/BJLsI3SYLeF3XNdAURPxUZd/H8o7p2mJK9zrkVjIodyd3pfQZ0/kGpR70hUx87rHFFp8snfB5Dh2Peh61kQMRc89vb+O8aVsRtTDrsjdCJnPugwQQDcRJbcf6oBPPTWCrfcQKfPt6VbgkCZwIUFibC7+F9C7zJYuOrHBEPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1576686409196813.5848767458805; Wed, 18 Dec 2019 08:26:49 -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-299-Es3NGk9IMXWhgFCmCN09kw-1; Wed, 18 Dec 2019 11:26:45 -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 6E2A818557C9; Wed, 18 Dec 2019 16:26:37 +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 3D9CE1000325; Wed, 18 Dec 2019 16:26:37 +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 F155B827D6; Wed, 18 Dec 2019 16:26:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBIGQRjp012492 for ; Wed, 18 Dec 2019 11:26:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 885075C28C; Wed, 18 Dec 2019 16:26:27 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB3FD5C1D4; Wed, 18 Dec 2019 16:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576686407; 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=BVK0yIiUXvFpkUhtPtV7CW75H81vczfCz1CIZdnte+U=; b=JWP4TD3Q5ItvyJU2nbQ4Aq913rN4CalFZHg30tCJJBe1FksIEY/tBjJnMwtFusz8ZVA1rL xKhGAQ8tUsxspSXOju3Rztm9hIkf1fXw1dE+WmfulRDJer3ZBdNJFgo9Lnn6Ijet8S3msh s3sM+BxoUSJuL70uOX2cQ30ZS/EpMao= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 17:26:13 +0100 Message-Id: <20191218162614.1639879-4-fidencio@redhat.com> In-Reply-To: <20191218162614.1639879-1-fidencio@redhat.com> References: <20191218162614.1639879-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v4 3/4] util: Rewrite virGetUserCacheDirectory() using g_get_user_cache_dir() 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 X-MC-Unique: Es3NGk9IMXWhgFCmCN09kw-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: Cole Robinson --- src/util/virutil.c | 57 ++++++++-------------------------------------- 1 file changed, 10 insertions(+), 47 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 9d98b0051a..db9378fa57 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -596,6 +596,16 @@ char *virGetUserConfigDirectory(void) } =20 =20 +char *virGetUserCacheDirectory(void) +{ +#ifdef WIN32 + return g_strdup(g_get_user_cache_dir()); +#else + return g_build_filename(g_get_user_cache_dir(), "libvirt", NULL); +#endif +} + + #ifdef HAVE_GETPWUID_R /* Look up fields from the user database for the given user. On * error, set errno, report the error if not instructed otherwise via @qui= et, @@ -746,29 +756,6 @@ char *virGetUserShell(uid_t uid) } =20 =20 -static char *virGetXDGDirectory(const char *xdgenvname, const char *xdgdef= dir) -{ - const char *path =3D getenv(xdgenvname); - char *ret =3D NULL; - char *home =3D NULL; - - if (path && path[0]) { - ret =3D g_strdup_printf("%s/libvirt", path); - } else { - home =3D virGetUserDirectory(); - if (home) - ret =3D g_strdup_printf("%s/%s/libvirt", home, xdgdefdir); - } - - VIR_FREE(home); - return ret; -} - -char *virGetUserCacheDirectory(void) -{ - return virGetXDGDirectory("XDG_CACHE_HOME", ".cache"); -} - char *virGetUserRuntimeDirectory(void) { const char *path =3D getenv("XDG_RUNTIME_DIR"); @@ -1192,21 +1179,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } =20 -char * -virGetUserCacheDirectory(void) -{ - char *ret; - if (virGetWin32SpecialFolder(CSIDL_INTERNET_CACHE, &ret) < 0) - return NULL; - - if (!ret) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine config directory")); - return NULL; - } - return ret; -} - char * virGetUserRuntimeDirectory(void) { @@ -1232,15 +1204,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } =20 -char * -virGetUserCacheDirectory(void) -{ - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virGetUserCacheDirectory is not available")); - - return NULL; -} - char * virGetUserRuntimeDirectory(void) { --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 15:28:16 2024 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=1576686410; cv=none; d=zohomail.com; s=zohoarc; b=GTHQDFNi2xG7cp1lyUuolwtl+L02laLJekx4WyPjcw3gFA93vSHB/HdXQTVoTEOdPpu3aw94wQz51JCPCIN4SbXUA/xwcvwqwqAurwCs7Mt1mmQ99HQMcHP4WN4YvxnZb9PNBwNLtFlJifKBKKXLQb8vzYI2EPjjFXeQ/RKnFBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576686410; 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=/iTl8TsCEzmjta/vvutYD3c352RU92nIBZK47wDAZQo=; b=JzqGDzqjVSvSIIjfPa0iWaFkr5GRfrmgGGP+j4TsXgQvPR299s7zZ1h+0tMF+gsRX0jeoXv91WbjzWs3dGMRvY487adl37UYUR8vi4CY2scpqwEvNWNRom7wFtEjjkr6dI7/rX7raPTL8te8Ayvkb+sb7AXM80bxSuWwXN9T7d8= 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 1576686410272123.7403548814184; Wed, 18 Dec 2019 08:26:50 -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-270-1U7sEVqNPgOAk1cY98TBUw-1; Wed, 18 Dec 2019 11:26:47 -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 7673FDBA9; Wed, 18 Dec 2019 16:26:41 +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 48B776025F; Wed, 18 Dec 2019 16:26:41 +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 027751803C40; Wed, 18 Dec 2019 16:26:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBIGQShY012503 for ; Wed, 18 Dec 2019 11:26:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 832FA5C28D; Wed, 18 Dec 2019 16:26:28 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id D62945C1D4; Wed, 18 Dec 2019 16:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576686408; 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=/iTl8TsCEzmjta/vvutYD3c352RU92nIBZK47wDAZQo=; b=bJh9d0P7XKiocBu9S6UiWpnLnMGTL3/rxOrLtJx/nU7rfaOjDYh2KVSOr3o8QB4RvAnLkn 1hfDCY2mSFdQ1Z4TiXP6aKtvov97PPKUyVWoUWiwkdLp+V0vRmiZzWmH7spng9Iq0eRKkQ 3kCvWGoIg66zS5RAH0KrWmsSRdFOlOU= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Wed, 18 Dec 2019 17:26:14 +0100 Message-Id: <20191218162614.1639879-5-fidencio@redhat.com> In-Reply-To: <20191218162614.1639879-1-fidencio@redhat.com> References: <20191218162614.1639879-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v4 4/4] util: Rewrite virGetUserRuntimeDirectory() using g_get_user_runtime_dir() 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 X-MC-Unique: 1U7sEVqNPgOAk1cY98TBUw-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: Cole Robinson --- src/util/virutil.c | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index db9378fa57..a28feb3daa 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -606,6 +606,16 @@ char *virGetUserCacheDirectory(void) } =20 =20 +char *virGetUserRuntimeDirectory(void) +{ +#ifdef WIN32 + return g_strdup(g_get_user_runtime_dir()); +#else + return g_build_filename(g_get_user_runtime_dir(), "libvirt", NULL); +#endif +} + + #ifdef HAVE_GETPWUID_R /* Look up fields from the user database for the given user. On * error, set errno, report the error if not instructed otherwise via @qui= et, @@ -756,20 +766,6 @@ char *virGetUserShell(uid_t uid) } =20 =20 -char *virGetUserRuntimeDirectory(void) -{ - const char *path =3D getenv("XDG_RUNTIME_DIR"); - - if (!path || !path[0]) { - return virGetUserCacheDirectory(); - } else { - char *ret; - - ret =3D g_strdup_printf("%s/libvirt", path); - return ret; - } -} - char *virGetUserName(uid_t uid) { char *ret; @@ -1179,12 +1175,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) return NULL; } =20 -char * -virGetUserRuntimeDirectory(void) -{ - return virGetUserCacheDirectory(); -} - # else /* !HAVE_GETPWUID_R && !WIN32 */ char * virGetUserDirectoryByUID(uid_t uid G_GNUC_UNUSED) @@ -1203,15 +1193,6 @@ virGetUserShell(uid_t uid G_GNUC_UNUSED) =20 return NULL; } - -char * -virGetUserRuntimeDirectory(void) -{ - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virGetUserRuntimeDirectory is not available")); - - return NULL; -} # endif /* ! HAVE_GETPWUID_R && ! WIN32 */ =20 char * --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list