pterm.c now relies on backend `exitcode' functions returning <0 when
[u/mdw/putty] / rlogin.c
index 7b13a78..8e73ec9 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -110,7 +110,7 @@ static char *rlogin_init(void *frontend_handle, void **backend_handle,
     char *err;
     Rlogin rlogin;
 
-    rlogin = smalloc(sizeof(*rlogin));
+    rlogin = snew(struct rlogin_tag);
     rlogin->fn = &fn_table;
     rlogin->s = NULL;
     rlogin->frontend = frontend_handle;
@@ -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 = {