diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-10-16 07:57:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-10-16 07:57:42 +0000 |
commit | 6c42f1a89e16d69d5fe24bb8b3f6b37148cfa308 (patch) | |
tree | cf10ba1b0621cdbc5b9e2acd23ea9121782a360a | |
parent | 65ff5b00bd786ca02ebfde9f76d0730acb9f68b4 (diff) | |
download | rtmux-6c42f1a89e16d69d5fe24bb8b3f6b37148cfa308.tar.gz rtmux-6c42f1a89e16d69d5fe24bb8b3f6b37148cfa308.tar.bz2 rtmux-6c42f1a89e16d69d5fe24bb8b3f6b37148cfa308.zip |
Fall back on normal session choice method if $TMUX exists but is invalid
rather than rejecting.
-rw-r--r-- | cmd.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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)); } |