mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
scp_recv_filedata: handle EOF more sensibly.
xfer_download_data could return actuallen as either 0 or -1 to indicate EOF. Now it's always 0, and scp_recv_filedata actually checks for that case and reports an error.
This commit is contained in:
parent
717129b0f2
commit
5d852585a1
7
pscp.c
7
pscp.c
@ -1560,6 +1560,13 @@ int scp_recv_filedata(char *data, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xfer_download_data(scp_sftp_xfer, &vbuf, &actuallen)) {
|
if (xfer_download_data(scp_sftp_xfer, &vbuf, &actuallen)) {
|
||||||
|
if (actuallen <= 0) {
|
||||||
|
tell_user(stderr, "pscp: %s while reading",
|
||||||
|
actuallen < 0 ? "error" : "end of file");
|
||||||
|
errs++;
|
||||||
|
sfree(vbuf);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* This assertion relies on the fact that the natural
|
* This assertion relies on the fact that the natural
|
||||||
* block size used in the xfer manager is at most that
|
* block size used in the xfer manager is at most that
|
||||||
|
1
sftp.c
1
sftp.c
@ -1226,6 +1226,7 @@ int xfer_download_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin)
|
|||||||
|
|
||||||
if ((rr->retlen < 0 && fxp_error_type()==SSH_FX_EOF) || rr->retlen == 0) {
|
if ((rr->retlen < 0 && fxp_error_type()==SSH_FX_EOF) || rr->retlen == 0) {
|
||||||
xfer->eof = TRUE;
|
xfer->eof = TRUE;
|
||||||
|
rr->retlen = 0;
|
||||||
rr->complete = -1;
|
rr->complete = -1;
|
||||||
#ifdef DEBUG_DOWNLOAD
|
#ifdef DEBUG_DOWNLOAD
|
||||||
printf("setting eof\n");
|
printf("setting eof\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user