Return a non-zero exit code in the event of a fatal-error SSH
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 26 Aug 2006 09:21:52 +0000 (09:21 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
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.

git-svn-id: svn://svn.tartarus.org/sgt/putty@6801 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index 38eb2bb..969ffbc 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);
 }
 
 /*