Blame SOURCES/0001-sftp-seek-Don-t-flush-buffers-on-same-offset.patch

9bf74a
From 486bb376218a37fe15318d7724d6eada36b81e6c Mon Sep 17 00:00:00 2001
9bf74a
From: "Richard W.M. Jones" <rjones@redhat.com>
9bf74a
Date: Tue, 26 Mar 2013 17:58:04 +0100
9bf74a
Subject: [PATCH 1/3] sftp: seek: Don't flush buffers on same offset
9bf74a
9bf74a
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
9bf74a
---
9bf74a
 src/sftp.c | 27 +++++++++++++++------------
9bf74a
 1 file changed, 15 insertions(+), 12 deletions(-)
9bf74a
9bf74a
diff --git a/src/sftp.c b/src/sftp.c
9bf74a
index d0536dd..3760025 100644
9bf74a
--- a/src/sftp.c
9bf74a
+++ b/src/sftp.c
9bf74a
@@ -2132,21 +2132,24 @@ libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *hnd,
9bf74a
 LIBSSH2_API void
9bf74a
 libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset)
9bf74a
 {
9bf74a
-    if(handle) {
9bf74a
-        handle->u.file.offset = handle->u.file.offset_sent = offset;
9bf74a
-        /* discard all pending requests and currently read data */
9bf74a
-        sftp_packetlist_flush(handle);
9bf74a
+    if(!handle)
9bf74a
+        return;
9bf74a
+    if(handle->u.file.offset == offset && handle->u.file.offset_sent == offset)
9bf74a
+        return;
9bf74a
 
9bf74a
-        /* free the left received buffered data */
9bf74a
-        if (handle->u.file.data_left) {
9bf74a
-            LIBSSH2_FREE(handle->sftp->channel->session, handle->u.file.data);
9bf74a
-            handle->u.file.data_left = handle->u.file.data_len = 0;
9bf74a
-            handle->u.file.data = NULL;
9bf74a
-        }
9bf74a
+    handle->u.file.offset = handle->u.file.offset_sent = offset;
9bf74a
+    /* discard all pending requests and currently read data */
9bf74a
+    sftp_packetlist_flush(handle);
9bf74a
 
9bf74a
-        /* reset EOF to False */
9bf74a
-        handle->u.file.eof = FALSE;
9bf74a
+    /* free the left received buffered data */
9bf74a
+    if (handle->u.file.data_left) {
9bf74a
+        LIBSSH2_FREE(handle->sftp->channel->session, handle->u.file.data);
9bf74a
+        handle->u.file.data_left = handle->u.file.data_len = 0;
9bf74a
+        handle->u.file.data = NULL;
9bf74a
     }
9bf74a
+
9bf74a
+    /* reset EOF to False */
9bf74a
+    handle->u.file.eof = FALSE;
9bf74a
 }
9bf74a
 
9bf74a
 /* libssh2_sftp_seek
9bf74a
-- 
9bf74a
1.8.1.4
9bf74a