pterm.c now relies on backend `exitcode' functions returning <0 when
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 31 Mar 2003 12:10:08 +0000 (12:10 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 31 Mar 2003 12:10:08 +0000 (12:10 +0000)
the session is still connected, and not returning an exit code until
after it's finished.

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

raw.c
rlogin.c
telnet.c

diff --git a/raw.c b/raw.c
index 53a8fc3..9eb2286 100644 (file)
--- a/raw.c
+++ b/raw.c
@@ -217,8 +217,12 @@ static void raw_provide_logctx(void *handle, void *logctx)
 
 static int raw_exitcode(void *handle)
 {
-    /* Exit codes are a meaningless concept in the Raw protocol */
-    return 0;
+    Raw raw = (Raw) handle;
+    if (raw->s != NULL)
+        return -1;                     /* still connected */
+    else
+        /* Exit codes are a meaningless concept in the Raw protocol */
+        return 0;
 }
 
 Backend raw_backend = {
index c3ef25c..8e73ec9 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -284,9 +284,12 @@ static void rlogin_provide_logctx(void *handle, void *logctx)
 
 static int rlogin_exitcode(void *handle)
 {
-    /* Rlogin rlogin = (Rlogin) handle; */
-    /* If we ever implement RSH, we'll probably need to do this properly */
-    return 0;
+    Rlogin rlogin = (Rlogin) handle;
+    if (rlogin->s != NULL)
+        return -1;                     /* still connected */
+    else
+        /* If we ever implement RSH, we'll probably need to do this properly */
+        return 0;
 }
 
 Backend rlogin_backend = {
index 28d696d..6f6deae 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -996,9 +996,12 @@ static void telnet_provide_logctx(void *handle, void *logctx)
 
 static int telnet_exitcode(void *handle)
 {
-    /* Telnet telnet = (Telnet) handle; */
-    /* Telnet doesn't transmit exit codes back to the client */
-    return 0;
+    Telnet telnet = (Telnet) handle;
+    if (telnet->s != NULL)
+        return -1;                     /* still connected */
+    else
+        /* Telnet doesn't transmit exit codes back to the client */
+        return 0;
 }
 
 Backend telnet_backend = {