diff options
author | 2009-08-12 09:14:25 +0000 | |
---|---|---|
committer | 2009-08-12 09:14:25 +0000 | |
commit | 3a4fea3b6d2a27188a45ad006cee2c7d94a55227 (patch) | |
tree | bcf657ae69d82a4dbaaeba872529c9bbfe9df186 /usr.bin/tmux/window.c | |
parent | sort options; (diff) | |
download | wireguard-openbsd-3a4fea3b6d2a27188a45ad006cee2c7d94a55227.tar.xz wireguard-openbsd-3a4fea3b6d2a27188a45ad006cee2c7d94a55227.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.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r-- | usr.bin/tmux/window.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 11ff9ec610c..71e0622428e 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.19 2009/08/11 21:28:11 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.20 2009/08/12 09:14:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); } |