mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Sync OpenBSD patchset 734:
Return the command client return code with MSG_EXIT now that MSG_ERROR and MSG_PRINT are unused. New clients should be compatible with old tmux servers but vice versa may print an error.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: server-client.c,v 1.34 2010-07-02 02:52:13 tcunha Exp $ */
|
||||
/* $Id: server-client.c,v 1.35 2010-07-17 14:36:40 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -663,6 +663,8 @@ server_client_msg_error(struct cmd_ctx *ctx, const char *fmt, ...)
|
||||
|
||||
fputc('\n', ctx->cmdclient->stderr_file);
|
||||
fflush(ctx->cmdclient->stderr_file);
|
||||
|
||||
ctx->cmdclient->retcode = 1;
|
||||
}
|
||||
|
||||
/* Callback to send print message to client. */
|
||||
@ -700,10 +702,11 @@ server_client_msg_info(struct cmd_ctx *ctx, const char *fmt, ...)
|
||||
void
|
||||
server_client_msg_command(struct client *c, struct msg_command_data *data)
|
||||
{
|
||||
struct cmd_ctx ctx;
|
||||
struct cmd_list *cmdlist = NULL;
|
||||
int argc;
|
||||
char **argv, *cause;
|
||||
struct cmd_ctx ctx;
|
||||
struct cmd_list *cmdlist = NULL;
|
||||
struct msg_exit_data exitdata;
|
||||
int argc;
|
||||
char **argv, *cause;
|
||||
|
||||
ctx.error = server_client_msg_error;
|
||||
ctx.print = server_client_msg_print;
|
||||
@ -734,15 +737,18 @@ server_client_msg_command(struct client *c, struct msg_command_data *data)
|
||||
}
|
||||
cmd_free_argv(argc, argv);
|
||||
|
||||
if (cmd_list_exec(cmdlist, &ctx) != 1)
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
if (cmd_list_exec(cmdlist, &ctx) != 1) {
|
||||
exitdata.retcode = c->retcode;
|
||||
server_write_client(c, MSG_EXIT, &exitdata, sizeof exitdata);
|
||||
}
|
||||
cmd_list_free(cmdlist);
|
||||
return;
|
||||
|
||||
error:
|
||||
if (cmdlist != NULL)
|
||||
cmd_list_free(cmdlist);
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
exitdata.retcode = c->retcode;
|
||||
server_write_client(c, MSG_EXIT, &exitdata, sizeof exitdata);
|
||||
}
|
||||
|
||||
/* Handle identify message. */
|
||||
|
Reference in New Issue
Block a user