sftp: seek: Don't flush buffers on same offset

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
This commit is contained in:
Richard W.M. Jones 2013-03-26 17:58:04 +01:00 committed by Daniel Stenberg
parent fe347a702f
commit 486bb37621

View File

@ -2132,7 +2132,11 @@ libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *hnd,
LIBSSH2_API void LIBSSH2_API void
libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset) libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset)
{ {
if(handle) { if(!handle)
return;
if(handle->u.file.offset == offset && handle->u.file.offset_sent == offset)
return;
handle->u.file.offset = handle->u.file.offset_sent = offset; handle->u.file.offset = handle->u.file.offset_sent = offset;
/* discard all pending requests and currently read data */ /* discard all pending requests and currently read data */
sftp_packetlist_flush(handle); sftp_packetlist_flush(handle);
@ -2146,7 +2150,6 @@ libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset)
/* reset EOF to False */ /* reset EOF to False */
handle->u.file.eof = FALSE; handle->u.file.eof = FALSE;
}
} }
/* libssh2_sftp_seek /* libssh2_sftp_seek