mirror of https://github.com/fairyglade/ly.git
Fix XDG Base Dirs implementation
renamed `XDG_CONFIG_DIR` -> `XDG_CONFIG_HOME` added `.config/ly` as fallback as specified in the specification, and pwd as last resort.
This commit is contained in:
parent
0a798831fe
commit
8610442c78
17
src/login.c
17
src/login.c
|
|
@ -306,11 +306,22 @@ void xauth(const char* display_name, const char* shell, char* pwd)
|
||||||
char* xauth_dir = getenv("XDG_RUNTIME_DIR");
|
char* xauth_dir = getenv("XDG_RUNTIME_DIR");
|
||||||
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
||||||
{
|
{
|
||||||
xauth_dir = getenv("XDG_CONFIG_DIR");
|
xauth_dir = getenv("XDG_CONFIG_HOME");
|
||||||
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
||||||
{
|
{
|
||||||
xauth_dir = pwd;
|
xauth_dir = strdup(pwd);
|
||||||
xauth_file = "lyxauth";
|
strcat(xauth_dir, "/.config/ly");
|
||||||
|
struct stat sb;
|
||||||
|
stat(xauth_dir, &sb);
|
||||||
|
if (!S_ISDIR(sb.st_mode))
|
||||||
|
{
|
||||||
|
xauth_dir = pwd;
|
||||||
|
// xauth_file is already assigned correctly
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xauth_file = "lyxauth";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue