Return 1 on error. Doh.

This commit is contained in:
Nicholas Marriott 2009-01-23 16:19:56 +00:00
parent 773b574ea2
commit 3f171917f6
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,7 @@
23 January 2009
* Oops. Return non-zero on error. Reported by Will Maier.
21 January 2009
* Handle SIGTERM (and kill-server which uses it), a bit more neatly - tidy
@ -997,7 +1001,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.230 2009-01-21 22:47:31 nicm Exp $
$Id: CHANGES,v 1.231 2009-01-23 16:19:56 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms

12
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.101 2009-01-21 22:47:31 nicm Exp $ */
/* $Id: tmux.c,v 1.102 2009-01-23 16:19:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -187,7 +187,7 @@ main(int argc, char **argv)
struct passwd *pw;
char *path, *cause, *home, *pass = NULL;
char rpath[MAXPATHLEN], cwd[MAXPATHLEN];
int n, opt, flags, unlock, start_server;
int retcode, opt, flags, unlock, start_server;
unlock = flags = 0;
path = NULL;
@ -377,6 +377,7 @@ main(int argc, char **argv)
}
buffer_destroy(b);
retcode = 0;
for (;;) {
pfd.fd = cctx.srv_fd;
pfd.events = POLLIN;
@ -403,9 +404,10 @@ main(int argc, char **argv)
switch (hdr.type) {
case MSG_EXIT:
case MSG_SHUTDOWN:
n = 0;
goto out;
case MSG_ERROR:
retcode = 1;
/* FALLTHROUGH */
case MSG_PRINT:
if (hdr.size > INT_MAX - 1)
fatalx("bad MSG_PRINT size");
@ -415,7 +417,7 @@ main(int argc, char **argv)
buffer_remove(cctx.srv_in, hdr.size);
goto restart;
case MSG_READY:
n = client_main(&cctx);
retcode = client_main(&cctx);
goto out;
default:
fatalx("unexpected command");
@ -433,5 +435,5 @@ out:
#ifdef DEBUG
xmalloc_report(getpid(), "client");
#endif
return (n);
return (retcode);
}