Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions atch.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ const char *session_shortname(void)
/* Returns the directory where session sockets are stored. */
void get_session_dir(char *buf, size_t size)
{
const char *dir_env = getenv("ATCH_SESSION_DIR");
const char *home = getenv("HOME");
const char *base = strrchr(progname, '/');
struct passwd *pw;

/* Allow override via ATCH_SESSION_DIR environment variable. */
if (dir_env && *dir_env) {
snprintf(buf, size, "%s", dir_env);
return;
}

base = base ? base + 1 : progname;

/* If $HOME is unset or empty, try the passwd database. */
Expand Down