The `socket' function in the backends is only ever checked to see if
[u/mdw/putty] / pscp.c
diff --git a/pscp.c b/pscp.c
index a906303..8e082e7 100644 (file)
--- a/pscp.c
+++ b/pscp.c
@@ -245,7 +245,7 @@ static int ssh_scp_recv(unsigned char *buf, int len)
     }
 
     while (outlen > 0) {
-       if (ssh_sftp_loop_iteration() < 0)
+       if (back->exitcode(backhandle) >= 0 || ssh_sftp_loop_iteration() < 0)
            return 0;                  /* doom */
     }
 
@@ -292,7 +292,7 @@ static void bump(char *fmt, ...)
     sfree(str2);
     errs++;
 
-    if (back != NULL && back->socket(backhandle) != NULL) {
+    if (back != NULL && back->connected(backhandle)) {
        char ch;
        back->special(backhandle, TS_EOF);
        ssh_scp_recv((unsigned char *) &ch, 1);
@@ -2285,7 +2285,7 @@ int psftp_main(int argc, char *argv[])
            tolocal(argc, argv);
     }
 
-    if (back != NULL && back->socket(backhandle) != NULL) {
+    if (back != NULL && back->connected(backhandle)) {
        char ch;
        back->special(backhandle, TS_EOF);
        ssh_scp_recv((unsigned char *) &ch, 1);