pterm.c now relies on backend `exitcode' functions returning <0 when
[u/mdw/putty] / raw.c
diff --git a/raw.c b/raw.c
index a22314f..9eb2286 100644 (file)
--- a/raw.c
+++ b/raw.c
@@ -80,7 +80,7 @@ static char *raw_init(void *frontend_handle, void **backend_handle,
     char *err;
     Raw raw;
 
-    raw = smalloc(sizeof(*raw));
+    raw = snew(struct raw_backend_data);
     raw->fn = &fn_table;
     raw->s = NULL;
     *backend_handle = raw;
@@ -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 = {