X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=pscp.c;h=454ec084c5cf5d161d713ed2f643e5dc4429bee2;hb=510f49e405e71ba5c97875e7a019364e1ef5fac9;hp=01c9ffa2fa57dae18fb651c3dea7f70c995c4add;hpb=12a080874fd9e5a4ae0a6dc39fb54b152927075d;p=PuTTY.git diff --git a/pscp.c b/pscp.c index 01c9ffa2..454ec084 100644 --- a/pscp.c +++ b/pscp.c @@ -699,7 +699,8 @@ void scp_sftp_listdir(const char *dirname) dirh = fxp_opendir_recv(pktin, req); if (dirh == NULL) { - printf("Unable to open %s: %s\n", dirname, fxp_error()); + tell_user(stderr, "Unable to open %s: %s\n", dirname, fxp_error()); + errs++; } else { nnames = namesize = 0; ournames = NULL; @@ -1559,6 +1560,12 @@ int scp_recv_filedata(char *data, int len) } if (xfer_download_data(scp_sftp_xfer, &vbuf, &actuallen)) { + if (actuallen <= 0) { + tell_user(stderr, "pscp: end of file while reading"); + errs++; + sfree(vbuf); + return -1; + } /* * This assertion relies on the fact that the natural * block size used in the xfer manager is at most that @@ -1962,8 +1969,10 @@ static void sink(const char *targ, const char *src) read = scp_recv_filedata(transbuf, (int)blksize.lo); if (read <= 0) bump("Lost connection"); - if (wrerror) + if (wrerror) { + received = uint64_add32(received, read); continue; + } if (write_to_file(f, transbuf, read) != (int)read) { wrerror = 1; /* FIXME: in sftp we can actually abort the transfer */ @@ -1971,6 +1980,7 @@ static void sink(const char *targ, const char *src) printf("\r%-25.25s | %50s\n", stat_name, "Write error.. waiting for end of file"); + received = uint64_add32(received, read); continue; } if (statistics) { @@ -2272,7 +2282,7 @@ void version(void) char *buildinfo_text = buildinfo("\n"); printf("pscp: %s\n%s\n", ver, buildinfo_text); sfree(buildinfo_text); - cleanup_exit(1); + exit(0); } void cmdline_error(const char *p, ...)