sftp_read: a short read is not end of file
A returned READ packet that is short will now only reduce the offset. This is a temporary fix as it is slightly better than the previous approach but still not very good.
This commit is contained in:
parent
9e79031ad7
commit
296d57bb2c
@ -1242,9 +1242,12 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * handle, char *buffer,
|
||||
return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
|
||||
"SFTP Protocol badness");
|
||||
|
||||
if(rc32 != chunk->len)
|
||||
/* a short read means this is the last read in the file */
|
||||
filep->eof = TRUE;
|
||||
if(rc32 != chunk->len) {
|
||||
/* a short read does not imply end of file, but we must adjust
|
||||
the offset_sent since it was advanced with a full
|
||||
chunk->len before */
|
||||
filep->offset_sent -= (chunk->len - rc32);
|
||||
}
|
||||
|
||||
if(total_read + rc32 > buffer_size) {
|
||||
/* figure out the overlap amount */
|
||||
|
Loading…
x
Reference in New Issue
Block a user