From e5ef4678dd54d70c4f334743d12e070b37b9549c Mon Sep 17 00:00:00 2001 From: Friedrich Vock Date: Tue, 30 Jan 2024 15:52:47 +0100 Subject: [PATCH] util/disk_cache: Use secure_getenv to determine cache directories Reviewed-by: Eric Engestrom Cc: mesa-stable Part-of: (cherry picked from commit 1c01fd028616c755fdac59016b17b07933a416ed) --- .pick_status.json | 2 +- src/util/disk_cache_os.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5c587d88974..dad408d80d3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -34,7 +34,7 @@ "description": "util/disk_cache: Use secure_getenv to determine cache directories", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c index d8bd8a0f532..bdc715cd06d 100644 --- a/src/util/disk_cache_os.c +++ b/src/util/disk_cache_os.c @@ -891,10 +891,10 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name, else if (cache_type == DISK_CACHE_DATABASE) cache_dir_name = CACHE_DIR_NAME_DB; - char *path = getenv("MESA_SHADER_CACHE_DIR"); + char *path = secure_getenv("MESA_SHADER_CACHE_DIR"); if (!path) { - path = getenv("MESA_GLSL_CACHE_DIR"); + path = secure_getenv("MESA_GLSL_CACHE_DIR"); if (path) fprintf(stderr, "*** MESA_GLSL_CACHE_DIR is deprecated; " @@ -911,7 +911,7 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name, } if (path == NULL) { - char *xdg_cache_home = getenv("XDG_CACHE_HOME"); + char *xdg_cache_home = secure_getenv("XDG_CACHE_HOME"); if (xdg_cache_home) { if (mkdir_if_needed(xdg_cache_home) == -1)