From nobody Tue May 7 13:56:14 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=1576615245; cv=none; d=zohomail.com; s=zohoarc; b=E7hNaj1BOR1UFFWnsS0ze0+QJQMCKAmnSVXHHsn6e8+eHsnB8O+fhqg+8/RGWZdsGRAVg5A66fdkWkewgvOKAl0qHeHSCZPWnv5HREbJtdP/OXCWpElL0LzJCwuw8FOKJHX9tmSSjSqK8DLsia6ytnJffj45qYQuyI18AabKYY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576615245; 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=aA7U1hlQ24gtdWiPP2mCzeEc05CAWz7VkbedKMXTYgUSrzixHO/cv4v3xRRA29o3zvU1clKh4X9V5rDUptQXRMd9W6x4UyVKWHayJyQQbkIJtuZamN89fj4MPY0k0rcPvfVlQksSycWB2N6/EQ8rce8qFuxmBv/aNN2D54am448= 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 1576615245208246.32823555405685; Tue, 17 Dec 2019 12:40:45 -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-176-BSfq0LejO8GOVRim81OLlg-1; Tue, 17 Dec 2019 15:40:41 -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 AA7BF1809A40; Tue, 17 Dec 2019 20:40: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 1BD5F5C1C3; Tue, 17 Dec 2019 20:40: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 8F591104905; Tue, 17 Dec 2019 20:40:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHKeSC2006609 for ; Tue, 17 Dec 2019 15:40:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1E87E7C82C; Tue, 17 Dec 2019 20:40:28 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 728726FF0F; Tue, 17 Dec 2019 20:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576615243; 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=bHEixY/yTVy5rs7LJdq3V6x+Ixi1pW5Hi549QQm1JHSNgG7TRpa0OvQ/ukdDYyRRT7GjZg nXMiL2lTNa0oge3XEBIl9pnO71ribLvonRWDOC3aQ4jUD+z1xkw2QyIhYZoFSScQWfz4q6 QRQEeoFSUaETCq1pl/PWKaBL0RKmyfM= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:40:18 +0100 Message-Id: <20191217204021.1018731-2-fidencio@redhat.com> In-Reply-To: <20191217204021.1018731-1-fidencio@redhat.com> References: <20191217204021.1018731-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v3 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: BSfq0LejO8GOVRim81OLlg-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 --- 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 13:56:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1576615250; cv=none; d=zohomail.com; s=zohoarc; b=Nai4VxSOuhaMZoZNnlPhbBlulNcVPvc1twIn337fh3YW4WRQU5rpuIzzt8GkkU9sq2UD46r+3xwDUJBm80rjvceP5Vtqpkcdx8+A4I0K3Naf0SjT7QAndSPxX/6RwHNXd/QaR8jhu3WKID9qHfmqNf9L9K1QY0DiCSYsyB+xJzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576615250; 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=SOQULsdeo93d/VPRA8AxTWAlQcsKqD2hs4Z+ci7LxUw=; b=RRGW6dAfhJKyWgpGBQjgz4HbxP74F3tqxzcmSTXZ+WIX4YEGlpCHkz/4RImUwDgS+B7ypUfWojwm4b2TKQ9+jDYDHlnztfo5v0kCv1GmVEnjymPCdwY82b+vPO8mLwMOo4k+LuZg49KIN4OTbn3nei963wyKwr/zaI4iU6v2wdY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576615250592724.4583358087804; Tue, 17 Dec 2019 12:40: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-359-QuRe44WRO1mahq-279vpnQ-1; Tue, 17 Dec 2019 15:40:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53E681809A29; Tue, 17 Dec 2019 20:40:41 +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 EAE5A68877; Tue, 17 Dec 2019 20:40:40 +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 82A75104908; Tue, 17 Dec 2019 20:40:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHKeT5N006619 for ; Tue, 17 Dec 2019 15:40:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 196917C82C; Tue, 17 Dec 2019 20:40:29 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BAA76FF0F; Tue, 17 Dec 2019 20:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576615249; 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=SOQULsdeo93d/VPRA8AxTWAlQcsKqD2hs4Z+ci7LxUw=; b=MYS4+OSPFGW0h7RPhT+rBzypAp7QNXGKp6tyt1RrifHcJht9GJwYt6n1k/9NN6MIkrPthl f7q3WipI/NgXD1NkNJPrTdD74bMjen0hcz3i9cpeP6A+SOxNJR6vaAjQfDGwjg++U+zghC M7y8cQsk/6rbAyBTcI2wYN3gsUQDQEo= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:40:19 +0100 Message-Id: <20191217204021.1018731-3-fidencio@redhat.com> In-Reply-To: <20191217204021.1018731-1-fidencio@redhat.com> References: <20191217204021.1018731-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v3 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.79 on 10.5.11.15 X-MC-Unique: QuRe44WRO1mahq-279vpnQ-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 --- 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..1bcdde9ad6 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_strdup_printf("%s/libvirt", g_get_user_config_dir()); +#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 13:56:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576615327; cv=none; d=zohomail.com; s=zohoarc; b=Um+l83MQB03e04f1AflKc8phAYHIDpMY9Uc/Qt1qBWiThv8bYnrPQ2Awy8R0eSA5HsNn7P6lQMXi67ZQxZWnaIgnDBjrwJH4yy/OQRecalo0jJD8q1v6UHmxytqwwbp2klswaLORDeGsErnI8IBNENw4axkDJged+nBqvX9glw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576615327; 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=aE6LRpuM2yDtFloR3gXK89O3/XBzrIYBqkwwhxTsn6o=; b=hBuY2hHQSqemwRTX7hWL1rQo48kwDRht/sWODksCHANBXH/HT/gLyq1JE+YaFy+JykXHOJD0XxqxzOhtazCKVPBDWmeV3/8zs74ekTQm+iPOjCVFdYe84P3Vj8NnJTcUInE5yhPEl4m+TsgUknA6MyRi7iSDcBKxh9ukK2Egzio= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1576615327020396.40528649096734; Tue, 17 Dec 2019 12:42:07 -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-42-l5kKSh0GPjO5XsneQScYmg-1; Tue, 17 Dec 2019 15:41:27 -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 D0C5D101F4E2; Tue, 17 Dec 2019 20:41:21 +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 A2D1A61355; Tue, 17 Dec 2019 20:41:21 +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 5AA9218089C8; Tue, 17 Dec 2019 20:41:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHKeUC0006629 for ; Tue, 17 Dec 2019 15:40:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 12D436FF0F; Tue, 17 Dec 2019 20:40:30 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66BB17C856; Tue, 17 Dec 2019 20:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576615322; 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=aE6LRpuM2yDtFloR3gXK89O3/XBzrIYBqkwwhxTsn6o=; b=cT3Vh71w1SLdcpJN+eEbcOQbR3euhpJfkpgIVlEy3GW1ZI7gwbbuCjeWh2Vtl5jSlGXXpy 46nk09QN+UDRsN7Mi6lYUQNoOzvoJK2LS1U1VTgbKYRlX3js2JZKxBA5VR6Dc7+D/qJeaI /MMpjiZxVs/Ssqwwz7nM/D1GRvsgJxQ= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:40:20 +0100 Message-Id: <20191217204021.1018731-4-fidencio@redhat.com> In-Reply-To: <20191217204021.1018731-1-fidencio@redhat.com> References: <20191217204021.1018731-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v3 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.79 on 10.5.11.11 X-MC-Unique: l5kKSh0GPjO5XsneQScYmg-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 --- 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 1bcdde9ad6..2e8b4e95b7 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_strdup_printf("%s/libvirt", g_get_user_cache_dir()); +#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 13:56:14 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=1576615294; cv=none; d=zohomail.com; s=zohoarc; b=n+qOfxA9UAJScp4es0jJud6uFOrRLrvIBrWv+7QPg3PV33oZ1/rjyEwTKUlWXro8zit2lLGqG/2GVbKtT09lm/NL+DwK/lILQrgFesVfgipmJ6MpFeLgkXQUlwXuGf5QMNqAKvKUZjJQPcLaet57hyEvyhQ/01oB//YSGB3fnAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576615294; 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=rftKjM1vkFUQBidljP0buE2KfMXd4QLIKwnI8iSTiyQ=; b=EwveOEhFXX2ilV3+e5jwRZAVDyyz+D4lbqYbebz4IrF3qGEh/d4w3oVrtKuMjUOBXkrayhOp9Z23HaEZDnBrxB39qyfsonyj+Ane1Usz7Ee0menkiKCLtVm3rEW72vjuVm83kH7Lujb6kleeSwvw9E6JrRRyPCa9hhG9ior0MMA= 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 1576615294180827.2275729891412; Tue, 17 Dec 2019 12:41:34 -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-310-jgsOia2iOhWOGIXEDOZERQ-1; Tue, 17 Dec 2019 15:41:30 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 54D2F1809A43; Tue, 17 Dec 2019 20:41:25 +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 2D4F06887B; Tue, 17 Dec 2019 20:41:25 +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 DB5C4104908; Tue, 17 Dec 2019 20:41:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHKeVmX006638 for ; Tue, 17 Dec 2019 15:40:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0AC9C7C82C; Tue, 17 Dec 2019 20:40:31 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FE526FF0F; Tue, 17 Dec 2019 20:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576615292; 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=rftKjM1vkFUQBidljP0buE2KfMXd4QLIKwnI8iSTiyQ=; b=ay41IFdBzrS5cyQ54+D3z1vtCSscjjB5CbOxXq/mwpHoClP9mvgGLoXXTARmm5b2hzGLFY erVnrqTc9Hn+IK1XHr4AH1ibJ6c8gN9hEoXWVrxD8HvvL5fofi+wfVuCWhikntW5QvaxLx 9c7uR8XP7zDhfu0wwxf0vGkH/Fq3AHE= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:40:21 +0100 Message-Id: <20191217204021.1018731-5-fidencio@redhat.com> In-Reply-To: <20191217204021.1018731-1-fidencio@redhat.com> References: <20191217204021.1018731-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v3 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.15 X-MC-Unique: jgsOia2iOhWOGIXEDOZERQ-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 --- 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 2e8b4e95b7..52b12126d7 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_strdup_printf("%s/libvirt", g_get_user_runtime_dir()); +#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