diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-12 09:14:25 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-12 09:14:25 +0000 |
commit | 9a52ef099a28eb1c80f265d122567a4ccf31ba3a (patch) | |
tree | a7591f0b79a00dc019049093621677215380fca3 | |
parent | 85e8b70625c415e25b332e59152f6383a49afa5d (diff) | |
download | rtmux-9a52ef099a28eb1c80f265d122567a4ccf31ba3a.tar.gz rtmux-9a52ef099a28eb1c80f265d122567a4ccf31ba3a.tar.bz2 rtmux-9a52ef099a28eb1c80f265d122567a4ccf31ba3a.zip |
When started as the shell, __progname contains a leading -, so hardcode "tmux"
for socket path and log files, and strip it when working out the shell.
-rw-r--r-- | tmux.c | 5 | ||||
-rw-r--r-- | window.c | 6 |
2 files changed, 7 insertions, 4 deletions
@@ -79,8 +79,7 @@ logfile(const char *name) log_close(); if (debug_level > 0) { - xasprintf( - &path, "%s-%s-%ld.log", __progname, name, (long) getpid()); + xasprintf(&path, "tmux-%s-%ld.log", name, (long) getpid()); log_open_file(debug_level, path); xfree(path); } @@ -184,7 +183,7 @@ makesockpath(const char *label) u_int uid; uid = getuid(); - xsnprintf(base, MAXPATHLEN, "%s/%s-%d", _PATH_TMP, __progname, uid); + xsnprintf(base, MAXPATHLEN, "%s/tmux-%d", _PATH_TMP, uid); if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST) return (NULL); @@ -62,6 +62,7 @@ const char * window_default_command(void) { const char *shell, *ptr; + char *progname; struct passwd *pw; shell = getenv("SHELL"); @@ -81,7 +82,10 @@ found: ptr++; else ptr = shell; - if (strcmp(ptr, __progname) == 0) + progname = __progname; + if (*progname == '-') + progname++; + if (strcmp(ptr, progname) == 0) return (_PATH_BSHELL); return (shell); } |