mirror of https://github.com/fairyglade/ly.git
Improvements on the last commit
Initially assigning `lyxauth` instead of `.lyxauth` so theres no need for a bunch of `else`s Using `.config` instead of `.config/ly` just like the XDG_CONFIG_HOME fallback, which also makes more sense.
This commit is contained in:
parent
8610442c78
commit
5787c26e69
14
src/login.c
14
src/login.c
|
|
@ -302,7 +302,7 @@ void remove_utmp_entry(struct utmp *entry) {
|
||||||
|
|
||||||
void xauth(const char* display_name, const char* shell, char* pwd)
|
void xauth(const char* display_name, const char* shell, char* pwd)
|
||||||
{
|
{
|
||||||
const char* xauth_file = ".lyxauth";
|
const char* xauth_file = "lyxauth";
|
||||||
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'))
|
||||||
{
|
{
|
||||||
|
|
@ -310,24 +310,16 @@ void xauth(const char* display_name, const char* shell, char* pwd)
|
||||||
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
||||||
{
|
{
|
||||||
xauth_dir = strdup(pwd);
|
xauth_dir = strdup(pwd);
|
||||||
strcat(xauth_dir, "/.config/ly");
|
strcat(xauth_dir, "/.config");
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
stat(xauth_dir, &sb);
|
stat(xauth_dir, &sb);
|
||||||
if (!S_ISDIR(sb.st_mode))
|
if (!S_ISDIR(sb.st_mode))
|
||||||
{
|
{
|
||||||
xauth_dir = pwd;
|
xauth_dir = pwd;
|
||||||
// xauth_file is already assigned correctly
|
xauth_file = ".lyxauth";
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xauth_file = "lyxauth";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
xauth_file = "lyxauth";
|
|
||||||
}
|
|
||||||
|
|
||||||
// trim trailing slashes
|
// trim trailing slashes
|
||||||
int i = strlen(xauth_dir) - 1;
|
int i = strlen(xauth_dir) - 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue