X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=psftp.c;h=a8baad6d2e4aa25a84a1bf886514e85fd37fdde9;hb=a8c4e67ff9ebdced0a4fb393f934b22cb5aae02f;hp=3543a06e0f3e60e54f8afa7ed8f5bc2ad582d23d;hpb=d23c0972cd850c77871f9a314e0520d7023c8b62;p=PuTTY.git diff --git a/psftp.c b/psftp.c index 3543a06e..a8baad6d 100644 --- a/psftp.c +++ b/psftp.c @@ -668,21 +668,19 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart) if (restart) { char decbuf[30]; struct fxp_attrs attrs; - int ret; req = fxp_fstat_send(fh); pktin = sftp_wait_for_reply(req); ret = fxp_fstat_recv(pktin, req, &attrs); if (!ret) { - close_rfile(file); printf("read size of %s: %s\n", outfname, fxp_error()); - return 0; + goto cleanup; } if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) { - close_rfile(file); printf("read size of %s: size was not given\n", outfname); - return 0; + ret = 0; + goto cleanup; } offset = attrs.size; uint64_decimal(offset, decbuf); @@ -735,6 +733,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart) xfer_cleanup(xfer); + cleanup: req = fxp_close_send(fh); pktin = sftp_wait_for_reply(req); fxp_close_recv(pktin, req);