summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-10 23:28:53 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-10 23:28:53 +0000
commit38ac9bb414cd7fa8e8bb16ded8f8bc6945e569f1 (patch)
tree0a9bc0f73fbb0ac8bc7e4c46b7c3a25df5271de7 /client.c
parentc01816c26ddcf72ae33bad86f0ae9dd53b34aa7a (diff)
Sync OpenBSD patchset 521:
Don't return 1 unless there was actually a problem (signal/lost server) rather than for all events (normal exit/detach/etc).
Diffstat (limited to 'client.c')
-rw-r--r--client.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/client.c b/client.c
index 96db6020..9826d050 100644
--- a/client.c
+++ b/client.c
@@ -1,4 +1,4 @@
-/* $Id: client.c,v 1.86 2009-11-08 23:07:14 tcunha Exp $ */
+/* $Id: client.c,v 1.87 2009-11-10 23:28:53 tcunha 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);
@@ -215,17 +216,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
@@ -236,6 +234,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:
@@ -279,6 +278,7 @@ client_callback(unused int fd, short events, unused void *data)
lost_server:
client_exitmsg = "lost server";
+ client_exitval = 1;
event_loopexit(NULL);
}
@@ -325,6 +325,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)