Sync OpenBSD patchset 802:

Use pointer rather than index for the client's last session.
This commit is contained in:
Tiago Cunha
2010-12-22 15:31:00 +00:00
parent 64d16cf2d6
commit bb728b89a7
5 changed files with 19 additions and 21 deletions

View File

@ -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();