Actually create runtime path if needed

This checked if the path was readable and only then tried creating it,
which... isn't right.

Fixes #7335.
This commit is contained in:
Fabian Homborg 2020-09-17 12:30:16 +02:00
parent 58245b6fe7
commit 181ce4a6b6

View file

@ -1421,8 +1421,7 @@ wcstring env_get_runtime_path() {
// Check that the path is actually usable. Technically this is guaranteed by the fdo spec but in
// practice it is not always the case: see #1828 and #2222.
int mode = R_OK | W_OK | X_OK;
if (dir != nullptr && access(dir, mode) == 0 && check_runtime_path(dir) == 0) {
if (dir != nullptr && check_runtime_path(dir) == 0) {
result = str2wcstring(dir);
} else {
// Don't rely on $USER being set, as setup_user() has not yet been called.