From nobody Sat May 4 04:27:54 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=1576600913; cv=none; d=zohomail.com; s=zohoarc; b=N5Q4ajBH3qDfHBbYM6xorS5XPGCGYMZp97MZmgKnY8d1TqIAknT1093J9bq/DQyagO0LQ8Va7AYejivoK1DNPFNG4wDWfQ1M8qm/BQfjPzoEAvz+bDP++m/hYODSPrVHjibQtCYlYD2zfFfqARKE+qAbPKBPCae4XV6EmhNA8w8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576600913; 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=8VokgieHnfTeCC+wtXRIv1/oElI230sHIxTrdJxLAb0=; b=SFsMEwF4/tW50t5IVZ7ypPRpDrDL22d4gknxRBuuuiVyY6FVBW0K7l81oZIx2DwJTpqBTxWUB6I2hYQdzMUEasOA4pjHQ1Ct39qwIiXm6cb4JDWBfw2CFUiun+6mR1cF8fGneT7BHY9Ef6puF68JUbJrx753ymCGY8B74MIvBNc= 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 1576600913271772.4122646492478; Tue, 17 Dec 2019 08:41:53 -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-177-r7E6WJtqOQKO18wWzRmsNw-1; Tue, 17 Dec 2019 11:41: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 8179E189CD24; Tue, 17 Dec 2019 16:41: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 5CE6F7C81A; Tue, 17 Dec 2019 16:41: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 12BD618089D0; Tue, 17 Dec 2019 16:41:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHGfWZx030076 for ; Tue, 17 Dec 2019 11:41:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 73CB560BF1; Tue, 17 Dec 2019 16:41:32 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id C85C460BE0; Tue, 17 Dec 2019 16:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576600911; 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=8VokgieHnfTeCC+wtXRIv1/oElI230sHIxTrdJxLAb0=; b=fPUoLin5rK4EL3WVYcMRbkf2VJgXq1HmQCEYIddhWHaNNFLxeU9hxX8h3BxqAmFUqx0WuW orCzyezv7Gcv9fuCa7t0LQt1MgDpywl2yLku07JH+O/CSLH0bBlgE1enBN3rjVKnLbGMsU SPzuI0svk1kbVWPa/Ce6k0v6sbmqxJE= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 17:41:22 +0100 Message-Id: <20191217164125.838590-2-fidencio@redhat.com> In-Reply-To: <20191217164125.838590-1-fidencio@redhat.com> References: <20191217164125.838590-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v2 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.13 X-MC-Unique: r7E6WJtqOQKO18wWzRmsNw-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..8c255abd7f 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_printf("%s/libvirt", 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 Sat May 4 04:27:54 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=1576600908; cv=none; d=zohomail.com; s=zohoarc; b=Vw5Ggp26sHqEmoQHmNjVrHpnfEdkglZst9kwrL2iGNpg6DxYdgEpFA7abpptyGiYX3DusdwNCk3HGzN/b7Xu0Q7CY7G+J0Em7ka2ciEwmRwt9sRTZl9di/WA/7eCahNORj67+H/CLTZJzjdKsL4Hnf0rRp5Tka9A6q/1lxVzw3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576600908; 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=K9rK2AT4M8m90k8mWB2SiM39S1Fex9V6ny/20qiu6nE=; b=CvZvLJNSAqhU6vYWlN/eRX9ySYZbOeS538t+CgxgW8m7c8a7x9KJgudq4/ucGNT6d+XnrL9vgD2yhhf1/uQgHgJIh4QL/jcG0h8FLJsDHXB20B/iSVhAKe7LexVKiajvF3hl6t7qKVK+EdzF8nqM9SIUJUcZrtMZp/xPn0Frwrc= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576600908969154.12923663883123; Tue, 17 Dec 2019 08:41: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-217-hMZNnavvMtW6iXes5q-H4Q-1; Tue, 17 Dec 2019 11:41:41 -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 C9DE3189CD1A; Tue, 17 Dec 2019 16:41: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 9B38D19C4F; Tue, 17 Dec 2019 16:41: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 29A2C1048E2; Tue, 17 Dec 2019 16:41:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHGfXHj030084 for ; Tue, 17 Dec 2019 11:41:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6E10260BF1; Tue, 17 Dec 2019 16:41:33 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id C153060BE0; Tue, 17 Dec 2019 16:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576600907; 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=K9rK2AT4M8m90k8mWB2SiM39S1Fex9V6ny/20qiu6nE=; b=NwcuMf0UdcNl/871EJteP27gPUqsK1ePkXKeNvYGZowmq6YOllkmUIaiyEJ+Jhs6lXIB6T zDXtyEIX3DsrBE5MG3Da0Yr87Qc4b1nPvAWKnElDyP7K+osd84ZRpIZw/eXwUcO/OL1hJe YDDppTrwfvITTUH1zak5Xa0Pe4wGqvY= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 17:41:23 +0100 Message-Id: <20191217164125.838590-3-fidencio@redhat.com> In-Reply-To: <20191217164125.838590-1-fidencio@redhat.com> References: <20191217164125.838590-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v2 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.23 X-MC-Unique: hMZNnavvMtW6iXes5q-H4Q-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 | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 8c255abd7f..63680974b8 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -586,6 +586,12 @@ virGetUserDirectory(void) } =20 =20 +char *virGetUserConfigDirectory(void) +{ + return g_strdup_printf("%s/libvirt", g_get_user_config_dir()); +} + + #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 +760,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 +1188,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 +1228,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 Sat May 4 04:27:54 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=1576600916; cv=none; d=zohomail.com; s=zohoarc; b=k3lzhjmdIcxBHGFXH5vQJ695FJx93SXWjuDsCrsM23BkJs5BaHeCVCC081oPh9tnb0zzqMhuHGJgFrtP1z6uSuOpHTokOCagephk2rYy6OQVhr3XphbXz6ldSz6J4dU39tkluasV5cQmJyhjNRNRWrfNbOMPsrmwsTRdScTLCEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576600916; 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=KXvTdqI2tpHdrb55Gj77nsuvs6ZerwnY4hOcPmhIhv0=; b=fORnGmADeXDZYl4HkC15Fmq194gZQg4MDS2p+2mEu8cYGrBMmNlUQv+FGEN0cmR98Bsch9R4uwL0h/4eFjE7U91BmKayoswYI5JPv0ow6mJJ0VyX5zos9S8FH+Mfeb+CAtH8jsgHEIsBs9z8aakYvlyY1ZtaTGlCTMfFuJcn/Ug= 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 1576600916675676.3279435795544; Tue, 17 Dec 2019 08:41:56 -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-336-dWPbeyf5M3KRmI5cdDwY_Q-1; Tue, 17 Dec 2019 11:41:53 -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 754DD189DF49; Tue, 17 Dec 2019 16:41:45 +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 47C2C10016DA; Tue, 17 Dec 2019 16:41:45 +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 066A1104907; Tue, 17 Dec 2019 16:41:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHGfY6a030094 for ; Tue, 17 Dec 2019 11:41:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 68B17785C0; Tue, 17 Dec 2019 16:41:34 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC19560BE0; Tue, 17 Dec 2019 16:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576600915; 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=KXvTdqI2tpHdrb55Gj77nsuvs6ZerwnY4hOcPmhIhv0=; b=jWOkGOKmmUE0QsURjNhyUL00i25qIbH/ZSFN7dkzPMpJQUQv/IRqkbTLbQyD+JsfPWkLuY UEUS/X5J2J6LnZNHCr7jpVwEkaAmOiC/aonTyXlTzohuXcxL0nc8fi+f3jPsHkhAgOz7ts sO+NKaY0jP1HFjGZdDZpDsPRjPZlHVk= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 17:41:24 +0100 Message-Id: <20191217164125.838590-4-fidencio@redhat.com> In-Reply-To: <20191217164125.838590-1-fidencio@redhat.com> References: <20191217164125.838590-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v2 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: dWPbeyf5M3KRmI5cdDwY_Q-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 | 53 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 63680974b8..9485316e05 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -592,6 +592,12 @@ char *virGetUserConfigDirectory(void) } =20 =20 +char *virGetUserCacheDirectory(void) +{ + return g_strdup_printf("%s/libvirt", g_get_user_cache_dir()); +} + + #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, @@ -742,29 +748,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"); @@ -1188,21 +1171,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) { @@ -1228,15 +1196,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 Sat May 4 04:27:54 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=1576600911; cv=none; d=zohomail.com; s=zohoarc; b=d4YbfKTs+gOWaOR0GVHu4Vzl7je3ZV+FH1jSwCxeHEX80NpJNZ9guJg+XsrmdTthR7AnEh8fyl8neOLCXx/yCbwC34G8/0ExqCT68hPBxHzisoDtilwKZQ5v1uwVKQR/0sQ6enVaiC1Xy4PSZLywVu1pXzpGT8KbjqYE9QJ816U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576600911; 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=qyh4H3Najm57T5tM/vaiBCkjPO9qmlVEILy1HDg7HxI=; b=g2bJDwFtKR/gzlne5VB7Ft7nZsGpwH/uH3FQrLfreIAwMvXPEjbhRAXH9NaUR81Z0XExxvcTO9recUSrXlpjPDFFDzj+XdpPdy7TrZXUKIKG/8/lOQaWh9rvb/ziEicjptIZHCdaLSXEq6LEEx+37W+ke4p/L1xqTICJTFsPaDI= 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 157660091179245.41150741987599; Tue, 17 Dec 2019 08:41:51 -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-29-6bnH8T_lNQGBHnm_e4X_xA-1; Tue, 17 Dec 2019 11:41:48 -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 8184D10734CC; Tue, 17 Dec 2019 16:41: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 5B4BD167A3; Tue, 17 Dec 2019 16:41: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 12B6718089CF; Tue, 17 Dec 2019 16:41:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHGfZ35030102 for ; Tue, 17 Dec 2019 11:41:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 61BEF785C1; Tue, 17 Dec 2019 16:41:35 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id B61C360BE0; Tue, 17 Dec 2019 16:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576600910; 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=qyh4H3Najm57T5tM/vaiBCkjPO9qmlVEILy1HDg7HxI=; b=ioVLSK1Tn42YSYTsNx0IDO0QA91M0/DyFuyV/KqdLe2/YTxAVP4CPBoDBz2nxqvrEbklU6 MIEQQoUMTiwtKwMJLr7wPBFgFr1hvAuR7FVF/GzaMVITCncDDvPx7hY5JKDj2U/sixdzH0 U17XyLzfdYLXS+W39y49HMvZ859L3fk= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 17:41:25 +0100 Message-Id: <20191217164125.838590-5-fidencio@redhat.com> In-Reply-To: <20191217164125.838590-1-fidencio@redhat.com> References: <20191217164125.838590-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v2 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.84 on 10.5.11.23 X-MC-Unique: 6bnH8T_lNQGBHnm_e4X_xA-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 | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 9485316e05..10bf96f193 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -598,6 +598,12 @@ char *virGetUserCacheDirectory(void) } =20 =20 +char *virGetUserRuntimeDirectory(void) +{ + return g_strdup_printf("%s/libvirt", g_get_user_runtime_dir()); +} + + #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, @@ -748,20 +754,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; @@ -1171,12 +1163,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) @@ -1195,15 +1181,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