Andy Hood points out that `#ifdef MONITOR_DEFAULTTONEAREST' would
[sgt/putty] / psftp.c
diff --git a/psftp.c b/psftp.c
index c7cd870..d395b6f 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -616,12 +616,13 @@ int sftp_general_put(struct sftp_command *cmd, int restart)
            }
        }
 
-       pktin = sftp_recv();
-       ret = xfer_upload_gotpkt(xfer, pktin);
-
-       if (!ret) {
-           printf("error while writing: %s\n", fxp_error());
-           err = 1;
+       if (!xfer_done(xfer)) {
+           pktin = sftp_recv();
+           ret = xfer_upload_gotpkt(xfer, pktin);
+           if (!ret) {
+               printf("error while writing: %s\n", fxp_error());
+               err = 1;
+           }
        }
     }