aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-04 11:52:03 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-04 11:52:03 +0000
commit68a5d5c00be0e0445e72c2e960588d21c4494467 (patch)
treefa6e1bf24e1287633ff08a41d45d2c7f1e8ed24d /tmux.c
parentff56ed7bd66f9be56f525838c21695a8574c1a09 (diff)
downloadrtmux-68a5d5c00be0e0445e72c2e960588d21c4494467.tar.gz
rtmux-68a5d5c00be0e0445e72c2e960588d21c4494467.tar.bz2
rtmux-68a5d5c00be0e0445e72c2e960588d21c4494467.zip
Window attachment, malloc debugging, fix a segfault with no sessions.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tmux.c b/tmux.c
index e4d3f57a..3a38c3af 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.28 2007-10-04 11:23:17 nicm Exp $ */
+/* $Id: tmux.c,v 1.29 2007-10-04 11:52:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -167,7 +167,7 @@ main(int argc, char **argv)
struct hdr hdr;
const char *shell;
char *path, *cause, name[MAXNAMELEN];
- int opt;
+ int n, opt;
*name = '\0';
path = NULL;
@@ -245,7 +245,8 @@ main(int argc, char **argv)
switch (hdr.type) {
case MSG_EXIT:
- exit(0);
+ n = 0;
+ goto out;
case MSG_PRINT:
if (hdr.size > INT_MAX - 1)
fatalx("bad MSG_PRINT size");
@@ -259,14 +260,21 @@ main(int argc, char **argv)
log_warnx("%.*s",
(int) hdr.size, BUFFER_OUT(cctx.srv_in));
buffer_remove(cctx.srv_in, hdr.size);
- exit(1);
+ n = 1;
+ goto out;
case MSG_READY:
- exit(client_main(&cctx));
+ n = client_main(&cctx);
+ goto out;
default:
fatalx("unexpected command");
}
}
- /* NOTREACHED */
+
+out:
+#ifdef DEBUG
+ xmalloc_report(getpid(), "client");
+#endif
+ return (n);
usage:
usage(&cause, NULL);