util/disk_cache: Use secure_getenv to determine cache directories

Reviewed-by: Eric Engestrom <eric@igalia.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27381>
(cherry picked from commit 1c01fd0286)
This commit is contained in:
Friedrich Vock 2024-01-30 15:52:47 +01:00 committed by Eric Engestrom
parent b8f2ff4232
commit 91ebaf1611
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -851,10 +851,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; "
@ -871,7 +871,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)