- dtucker@cvs.openbsd.org 2003/12/09 23:45:32
     [clientloop.c]
     Clear exit code when ssh -N is terminated with a SIGTERM.  ok markus@
diff --git a/ChangeLog b/ChangeLog
index 0b97adc..b7a73ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,9 @@
      [ssh_config.5 sshconnect.c sshd.c sshd_config.5]
      rename keepalive to tcpkeepalive; the old name causes too much
      confusion; ok djm, dtucker; with help from jmc@
+   - dtucker@cvs.openbsd.org 2003/12/09 23:45:32
+     [clientloop.c]
+     Clear exit code when ssh -N is terminated with a SIGTERM.  ok markus@
 
 20031209
  - (dtucker) OpenBSD CVS Sync
@@ -1586,4 +1589,4 @@
  - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
    Report from murple@murple.net, diagnosis from dtucker@zip.com.au
 
-$Id: ChangeLog,v 1.3143 2003/12/17 05:31:10 djm Exp $
+$Id: ChangeLog,v 1.3144 2003/12/17 05:31:53 djm Exp $
diff --git a/clientloop.c b/clientloop.c
index e7a7d9f..67b9dfc 100644
--- a/clientloop.c
+++ b/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 @@
 /* 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 @@
 	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);