]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Return a non-zero exit code in the event of a fatal-error SSH
authorSimon Tatham <anakin@pobox.com>
Sat, 26 Aug 2006 09:21:52 +0000 (09:21 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 26 Aug 2006 09:21:52 +0000 (09:21 +0000)
session termination. `Close window only on clean exit' was not
working properly on Unix in the absence of this:
notify_remote_exit() was being called and ssh_return_exitcode was
returning zero, causing gtk_main_quit() to be called, _before_
connection_fatal() happened.

[originally from svn r6801]

ssh.c

diff --git a/ssh.c b/ssh.c
index 38eb2bbd2bd8efcc06c23c297ef2675aa82afc3a..969ffbc0f601924f722a9175de64d0a3da04870b 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <assert.h>
+#include <limits.h>
 
 #include "putty.h"
 #include "tree234.h"
@@ -8764,7 +8765,7 @@ static int ssh_return_exitcode(void *handle)
     if (ssh->s != NULL)
         return -1;
     else
-        return (ssh->exitcode >= 0 ? ssh->exitcode : 0);
+        return (ssh->exitcode >= 0 ? ssh->exitcode : INT_MAX);
 }
 
 /*