-/* $OpenBSD: cmd-detach-client.c,v 1.37 2024/03/21 11:26:28 nicm Exp $ */
+/* $OpenBSD: cmd-detach-client.c,v 1.38 2024/03/21 11:27:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
{
struct args *args = cmd_get_args(self);
struct cmd_find_state *source = cmdq_get_source(item);
- struct client *c = cmdq_get_client(item);
struct client *tc = cmdq_get_target_client(item), *loop;
struct session *s;
enum msgtype msgtype;
return (CMD_RETURN_NORMAL);
}
- if (cmd != NULL) {
- if (c == NULL || c->session == NULL) {
- cmdq_error(item, "must be attached for -E");
- return (CMD_RETURN_ERROR);
- }
+ if (cmd != NULL)
server_client_exec(tc, cmd);
- } else
+ else
server_client_detach(tc, msgtype);
return (CMD_RETURN_STOP);
}