summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2003-12-09 23:45:32 +0000
committerdtucker <dtucker@openbsd.org>2003-12-09 23:45:32 +0000
commitbaf086910d5a8de6dacfdbdfef33273612ba569d (patch)
treef17349174f3ff06e39505f3bf94b7977823ef828
parentmatch a couple more models (diff)
downloadwireguard-openbsd-baf086910d5a8de6dacfdbdfef33273612ba569d.tar.xz
wireguard-openbsd-baf086910d5a8de6dacfdbdfef33273612ba569d.zip
Clear exit code when ssh -N is terminated with a SIGTERM. ok markus@
-rw-r--r--usr.bin/ssh/clientloop.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c
index e7a7d9fa717..67b9dfcea8b 100644
--- a/usr.bin/ssh/clientloop.c
+++ b/usr.bin/ssh/clientloop.c
@@ -59,7 +59,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.115 2003/09/23 20:41:11 markus Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.116 2003/12/09 23:45:32 dtucker Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -89,6 +89,9 @@ extern Options options;
/* Flag indicating that stdin should be redirected from /dev/null. */
extern int stdin_null_flag;
+/* Flag indicating that no shell has been requested */
+extern int no_shell_flag;
+
/*
* Name of the host we are connecting to. This is the name given on the
* command line, or the HostName specified for the user-supplied name in a
@@ -1031,6 +1034,16 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
if (!isatty(fileno(stderr)))
unset_nonblock(fileno(stderr));
+ /*
+ * If there was no shell or command requested, there will be no remote
+ * exit status to be returned. In that case, clear error code if the
+ * connection was deliberately terminated at this end.
+ */
+ if (no_shell_flag && received_signal == SIGTERM) {
+ received_signal = 0;
+ exit_status = 0;
+ }
+
if (received_signal)
fatal("Killed by signal %d.", (int) received_signal);