From 7e3cc5fd121ff54fbe3e1b9d531cfba63bcf9768 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 13 Nov 2007 09:53:47 +0000 Subject: Use ctx->client/ctx->session inline instead of temporary variables which were being reused and causing confusion and problems. --- cmd-detach-session.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'cmd-detach-session.c') diff --git a/cmd-detach-session.c b/cmd-detach-session.c index bc5c198a..6c8be72c 100644 --- a/cmd-detach-session.c +++ b/cmd-detach-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-detach-session.c,v 1.6 2007-10-19 09:21:25 nicm Exp $ */ +/* $Id: cmd-detach-session.c,v 1.7 2007-11-13 09:53:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -84,8 +84,7 @@ void cmd_detach_session_exec(void *ptr, struct cmd_ctx *ctx) { struct cmd_detach_session_data *data = ptr, std = { 0 }; - struct client *c = ctx->client, *cp; - struct session *s = ctx->session; + struct client *c; u_int i; if (data == NULL) @@ -93,16 +92,16 @@ cmd_detach_session_exec(void *ptr, struct cmd_ctx *ctx) if (data->flag_all) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - cp = ARRAY_ITEM(&clients, i); - if (cp == NULL || cp->session != s) + c = ARRAY_ITEM(&clients, i); + if (c == NULL || c->session != ctx->session) continue; - server_write_client(cp, MSG_DETACH, NULL, 0); + server_write_client(c, MSG_DETACH, NULL, 0); } } else if (ctx->flags & CMD_KEY) - server_write_client(c, MSG_DETACH, NULL, 0); + server_write_client(ctx->client, MSG_DETACH, NULL, 0); if (!(ctx->flags & CMD_KEY)) - server_write_client(c, MSG_EXIT, NULL, 0); + server_write_client(ctx->client, MSG_EXIT, NULL, 0); } void -- cgit