From f206d52b5e845a0e72e9b40207870d2d1d441149 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 16 Oct 2010 07:57:43 +0000 Subject: Fall back on normal session choice method if $TMUX exists but is invalid rather than rejecting. --- usr.bin/tmux/cmd.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'usr.bin/tmux') 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 @@ -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)); } -- cgit v1.2.3