New option to allow use of the local OS username for login to the remote side
[u/mdw/putty] / psftp.c
diff --git a/psftp.c b/psftp.c
index 2e25d97..63446d4 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -707,7 +707,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
        if (!xfer_done(xfer)) {
            pktin = sftp_recv();
            ret = xfer_upload_gotpkt(xfer, pktin);
-           if (!ret) {
+           if (ret <= 0 && !err) {
                printf("error while writing: %s\n", fxp_error());
                err = 1;
            }
@@ -2798,6 +2798,8 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
     back->provide_logctx(backhandle, logctx);
     console_provide_logctx(logctx);
     while (!back->sendok(backhandle)) {
+       if (back->exitcode(backhandle) >= 0)
+           return 1;
        if (ssh_sftp_loop_iteration() < 0) {
            fprintf(stderr, "ssh_init: error during SSH connection setup\n");
            return 1;