diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-10-16 07:57:43 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-10-16 07:57:43 +0000 |
commit | f206d52b5e845a0e72e9b40207870d2d1d441149 (patch) | |
tree | 102bb73975b3995025f4744620bf88097b96b720 /usr.bin/tmux | |
parent | 74714b25c74598a0d799f5db5ac2399a8eff8fca (diff) |
Fall back on normal session choice method if $TMUX exists but is invalid
rather than rejecting.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 68077acf865..929bb55b5c6 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.43 2010/07/14 18:37:49 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.44 2010/10/16 07:57:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -340,15 +340,11 @@ cmd_current_session(struct cmd_ctx *ctx) } /* Use the session from the TMUX environment variable. */ - if (data != NULL && data->pid != -1) { - if (data->pid != getpid()) - return (NULL); - if (data->idx > ARRAY_LENGTH(&sessions)) - return (NULL); - if ((s = ARRAY_ITEM(&sessions, data->idx)) == NULL) - return (NULL); + if (data != NULL && + data->pid == getpid() && + data->idx <= ARRAY_LENGTH(&sessions) && + (s = ARRAY_ITEM(&sessions, data->idx)) != NULL) return (s); - } return (cmd_choose_session(&sessions)); } |