diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-02 20:15:50 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-02 20:15:50 +0000 |
commit | 7180b922aa0c73edb7ed27f42c3510d0cc8db325 (patch) | |
tree | 12e9861d875cd99b63c6223a04044322360d84a9 /usr.bin/tmux/client.c | |
parent | 4368740666b3af0f30f07bdc94cbdc3ec5e46ed1 (diff) |
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.
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r-- | usr.bin/tmux/client.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index adc86d45775..3f64e200067 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.15 2009/09/02 20:00:10 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.16 2009/09/02 20:15:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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: |