diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-10 15:47:49 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-10 15:47:49 +0000 |
commit | f7e62eaf140ea59e3123dfa40ef750d1012293c4 (patch) | |
tree | 56626ac53ae262345aede6cfdce2bda7c06ec749 | |
parent | be33c14af56c50479a2756af326823215b453c83 (diff) |
Don't return 1 unless there was actually a problem (signal/lost server) rather
than for all events (normal exit/detach/etc).
-rw-r--r-- | usr.bin/tmux/client.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index 7bc0141b058..3197b7c4e38 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.31 2009/11/04 22:57:49 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.32 2009/11/10 15:47:48 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -37,6 +37,7 @@ struct imsgbuf client_ibuf; struct event client_event; const char *client_exitmsg; +int client_exitval; void client_send_identify(int); void client_send_environ(void); @@ -211,17 +212,14 @@ client_main(void) goto out; /* Set the event and dispatch. */ - client_update_event(); + client_update_event(); event_dispatch(); out: /* Print the exit message, if any, and exit. */ - if (client_exitmsg != NULL) { - if (!login_shell) - printf("[%s]\n", client_exitmsg); - exit(1); - } - exit(0); + if (client_exitmsg != NULL && !login_shell) + printf("[%s]\n", client_exitmsg); + exit(client_exitval); } void @@ -232,6 +230,7 @@ client_signal(int sig, unused short events, unused void *data) switch (sig) { case SIGTERM: client_exitmsg = "terminated"; + client_exitval = 1; client_write_server(MSG_EXITING, NULL, 0); break; case SIGWINCH: @@ -275,6 +274,7 @@ client_callback(unused int fd, short events, unused void *data) lost_server: client_exitmsg = "lost server"; + client_exitval = 1; event_loopexit(NULL); } @@ -321,6 +321,7 @@ client_dispatch(void) client_write_server(MSG_EXITING, NULL, 0); client_exitmsg = "server exited"; + client_exitval = 1; break; case MSG_SUSPEND: if (datalen != 0) |