diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-09-02 20:15:49 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-09-02 20:15:49 +0000 |
commit | 459abafcea844ebb2de8cc58761edb84ffa8dec8 (patch) | |
tree | 5ef610b4fe942fccf526c539ea4e97d9518a1293 | |
parent | 7a4bac82d7d3cc355c92b312fda00fa9523e79f9 (diff) | |
download | rtmux-459abafcea844ebb2de8cc58761edb84ffa8dec8.tar.gz rtmux-459abafcea844ebb2de8cc58761edb84ffa8dec8.tar.bz2 rtmux-459abafcea844ebb2de8cc58761edb84ffa8dec8.zip |
That was the wrong fix. MSG_ERROR should set the error and the client should
use the error and exit on MSG_EXIT (it was being handled in the default
case). Undo the last change, move the errstr check into the MSG_EXIT case, and
add a comment.
-rw-r--r-- | client.c | 11 | ||||
-rw-r--r-- | tmux.h | 3 |
2 files changed, 7 insertions, 7 deletions
@@ -214,16 +214,17 @@ client_main(struct client_ctx *cctx) printf("[server exited]\n"); return (0); case CCTX_EXIT: + if (cctx->errstr != NULL) { + printf("[error: %s]\n", cctx->errstr); + return (1); + } printf("[exited]\n"); return (0); case CCTX_DETACH: printf("[detached]\n"); return (0); - case CCTX_ERROR: - printf("[error: %s]\n", cctx->errstr); - return (1); default: - printf("[error: unknown error]\n"); + printf("[unknown error]\n"); return (1); } } @@ -277,8 +278,8 @@ client_msg_dispatch(struct client_ctx *cctx) memcpy(&printdata, imsg.data, sizeof printdata); printdata.msg[(sizeof printdata.msg) - 1] = '\0'; + /* Error string used after exit message from server. */ cctx->errstr = xstrdup(printdata.msg); - cctx->exittype = CCTX_ERROR; imsg_free(&imsg); return (-1); case MSG_EXIT: @@ -973,8 +973,7 @@ struct client_ctx { CCTX_DETACH, CCTX_EXIT, CCTX_DIED, - CCTX_SHUTDOWN, - CCTX_ERROR + CCTX_SHUTDOWN } exittype; const char *errstr; }; |