From 5787c26e6951e6e04bbb353b3126d2c44e6ffec2 Mon Sep 17 00:00:00 2001 From: Cavernosa <42952107+Cavernosa@users.noreply.github.com> Date: Mon, 8 Aug 2022 03:13:45 +0000 Subject: [PATCH] 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. --- src/login.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/login.c b/src/login.c index 69e9302..551f52e 100644 --- a/src/login.c +++ b/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) { - const char* xauth_file = ".lyxauth"; + const char* xauth_file = "lyxauth"; char* xauth_dir = getenv("XDG_RUNTIME_DIR"); 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')) { xauth_dir = strdup(pwd); - strcat(xauth_dir, "/.config/ly"); + strcat(xauth_dir, "/.config"); 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"; + xauth_file = ".lyxauth"; } } } - else - { - xauth_file = "lyxauth"; - } // trim trailing slashes int i = strlen(xauth_dir) - 1;