mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
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).
This commit is contained in:
parent
c01816c26d
commit
38ac9bb414
13
client.c
13
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>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -37,6 +37,7 @@
|
|||||||
struct imsgbuf client_ibuf;
|
struct imsgbuf client_ibuf;
|
||||||
struct event client_event;
|
struct event client_event;
|
||||||
const char *client_exitmsg;
|
const char *client_exitmsg;
|
||||||
|
int client_exitval;
|
||||||
|
|
||||||
void client_send_identify(int);
|
void client_send_identify(int);
|
||||||
void client_send_environ(void);
|
void client_send_environ(void);
|
||||||
@ -220,12 +221,9 @@ client_main(void)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
/* Print the exit message, if any, and exit. */
|
/* Print the exit message, if any, and exit. */
|
||||||
if (client_exitmsg != NULL) {
|
if (client_exitmsg != NULL && !login_shell)
|
||||||
if (!login_shell)
|
|
||||||
printf("[%s]\n", client_exitmsg);
|
printf("[%s]\n", client_exitmsg);
|
||||||
exit(1);
|
exit(client_exitval);
|
||||||
}
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -236,6 +234,7 @@ client_signal(int sig, unused short events, unused void *data)
|
|||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
client_exitmsg = "terminated";
|
client_exitmsg = "terminated";
|
||||||
|
client_exitval = 1;
|
||||||
client_write_server(MSG_EXITING, NULL, 0);
|
client_write_server(MSG_EXITING, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case SIGWINCH:
|
case SIGWINCH:
|
||||||
@ -279,6 +278,7 @@ client_callback(unused int fd, short events, unused void *data)
|
|||||||
|
|
||||||
lost_server:
|
lost_server:
|
||||||
client_exitmsg = "lost server";
|
client_exitmsg = "lost server";
|
||||||
|
client_exitval = 1;
|
||||||
event_loopexit(NULL);
|
event_loopexit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +325,7 @@ client_dispatch(void)
|
|||||||
|
|
||||||
client_write_server(MSG_EXITING, NULL, 0);
|
client_write_server(MSG_EXITING, NULL, 0);
|
||||||
client_exitmsg = "server exited";
|
client_exitmsg = "server exited";
|
||||||
|
client_exitval = 1;
|
||||||
break;
|
break;
|
||||||
case MSG_SUSPEND:
|
case MSG_SUSPEND:
|
||||||
if (datalen != 0)
|
if (datalen != 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user