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;
}
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
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 */
printf("\r%-25.25s | %50s\n",
stat_name,
"Write error.. waiting for end of file");
+ received = uint64_add32(received, read);
continue;
}
if (statistics) {
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, ...)