aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-09-02 20:16:29 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-09-02 20:16:29 +0000
commitd33caca6c7e0c416a64dcd839900da03e62c1a1a (patch)
treed740a5fc4013e1240e5a3edf878e38059c657f28
parentc23bde74ec034f864410c9b71c3ef72d122df719 (diff)
downloadrtmux-d33caca6c7e0c416a64dcd839900da03e62c1a1a.tar.gz
rtmux-d33caca6c7e0c416a64dcd839900da03e62c1a1a.tar.bz2
rtmux-d33caca6c7e0c416a64dcd839900da03e62c1a1a.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.c14
-rw-r--r--tmux.h5
2 files changed, 10 insertions, 9 deletions
diff --git a/client.c b/client.c
index 32bf6b9c..e3014b0a 100644
--- a/client.c
+++ b/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.15 2009/09/02 20:00:10 nicm Exp $ */
+/* $Id: client.c,v 1.68 2009-09-02 20:16:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -218,16 +218,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);
}
}
@@ -267,6 +268,7 @@ client_msg_dispatch(struct client_ctx *cctx)
return (0);
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
+ log_debug("CLIENT GOT %d", imsg.hdr.type);
switch (imsg.hdr.type) {
case MSG_DETACH:
if (datalen != 0)
@@ -281,8 +283,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:
diff --git a/tmux.h b/tmux.h
index 1e1d5208..0438adb3 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.432 2009-09-02 20:01:22 nicm Exp $ */
+/* $Id: tmux.h,v 1.433 2009-09-02 20:16:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -970,8 +970,7 @@ struct client_ctx {
CCTX_DETACH,
CCTX_EXIT,
CCTX_DIED,
- CCTX_SHUTDOWN,
- CCTX_ERROR
+ CCTX_SHUTDOWN
} exittype;
const char *errstr;
};