util/disk_cache: fix ~/.cache/ permissions

XDG Base Dir spec [1] says:
> If, when attempting to write a file, the destination directory is
> non-existent an attempt should be made to create it with permission
> `0700`. If the destination directory exists already the permissions
> should not be changed.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4103
Fixes: 87ab26b2ab ("glsl: Add initial functions to implement an on-disk cache")
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23952>
This commit is contained in:
Eric Engestrom 2023-06-30 16:27:20 +01:00 committed by Marge Bot
parent 384c8677f5
commit e32cb99dcb

View file

@ -124,7 +124,7 @@ mkdir_if_needed(const char *path)
}
}
int ret = mkdir(path, 0755);
int ret = mkdir(path, 0700);
if (ret == 0 || (ret == -1 && errno == EEXIST))
return 0;