mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Check that $XDG_RUNTIME_DIR is valid and accessible
Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
This commit is contained in:
parent
a0eef2663a
commit
b4b5c2188f
1 changed files with 6 additions and 1 deletions
|
@ -147,7 +147,12 @@ static wcstring get_runtime_path()
|
||||||
{
|
{
|
||||||
wcstring result;
|
wcstring result;
|
||||||
const char *dir = getenv("XDG_RUNTIME_DIR");
|
const char *dir = getenv("XDG_RUNTIME_DIR");
|
||||||
if (dir != NULL)
|
|
||||||
|
// 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 != NULL && access(dir, mode) == 0 && check_runtime_path(dir) == 0)
|
||||||
{
|
{
|
||||||
result = str2wcstring(dir);
|
result = str2wcstring(dir);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue