summaryrefslogtreecommitdiffstats
path: root/cmd-switch-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-12-22 15:31:00 +0000
committerTiago Cunha <tcunha@gmx.com>2010-12-22 15:31:00 +0000
commitbb728b89a7b0e0f1921c336d3f25ab0ee02322f8 (patch)
tree7b130934f4b366ad4094dc66a1a85dbc4e74dcf9 /cmd-switch-client.c
parent64d16cf2d67c42642401cd0bbaeb278a1c00822a (diff)
Sync OpenBSD patchset 802:
Use pointer rather than index for the client's last session.
Diffstat (limited to 'cmd-switch-client.c')
-rw-r--r--cmd-switch-client.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 20bf7f9b..e12bd1d6 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-switch-client.c,v 1.22 2010-12-11 18:42:20 nicm Exp $ */
+/* $Id: cmd-switch-client.c,v 1.23 2010-12-22 15:31:00 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -159,9 +159,8 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
} else if (data->flag_last) {
- if (c->last_session != UINT_MAX &&
- c->last_session < ARRAY_LENGTH(&sessions))
- s = ARRAY_ITEM(&sessions, c->last_session);
+ if (c->last_session != NULL && session_alive(c->last_session))
+ s = c->last_session;
if (s == NULL) {
ctx->error(ctx, "can't find last session");
return (-1);
@@ -172,7 +171,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
if (c->session != NULL)
- session_index(c->session, &c->last_session);
+ c->last_session = c->session;
c->session = s;
recalculate_sizes();