[Pkg-owncloud-commits] [owncloud-client] 53/69: Legacy propagator: Don't use mtime retrieved via _fstat64.

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Nov 7 19:41:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit eed91ddf469ec7cef9803837ab32e7e2c606c950
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Thu Nov 6 10:42:00 2014 +0100

    Legacy propagator: Don't use mtime retrieved via _fstat64.
    
    May be the cause of #2431
---
 csync/src/httpbf/src/httpbf.c    |  5 +++--
 csync/src/httpbf/src/httpbf.h    |  1 +
 src/mirall/propagator_legacy.cpp | 12 +++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/csync/src/httpbf/src/httpbf.c b/csync/src/httpbf/src/httpbf.c
index f914655..4008024 100644
--- a/csync/src/httpbf/src/httpbf.c
+++ b/csync/src/httpbf/src/httpbf.c
@@ -96,6 +96,7 @@ hbf_transfer_t *hbf_init_transfer( const char *dest_uri ) {
     transfer->block_size = DEFAULT_BLOCK_SIZE;
     transfer->threshold = transfer->block_size;
     transfer->modtime_accepted = 0;
+    transfer->oc_header_modtime = 0;
 
     return transfer;
 }
@@ -491,8 +492,8 @@ Hbf_State hbf_transfer( ne_session *session, hbf_transfer_t *transfer, const cha
 
                 snprintf(buf, sizeof(buf), "%"PRId64, transfer->stat_size);
                 ne_add_request_header(req, "OC-Total-Length", buf);
-                if( transfer->modtime > 0 ) {
-                    snprintf(buf, sizeof(buf), "%"PRId64, transfer->modtime);
+                if( transfer->oc_header_modtime > 0 ) {
+                    snprintf(buf, sizeof(buf), "%"PRId64, transfer->oc_header_modtime);
                     ne_add_request_header(req, "X-OC-Mtime", buf);
                 }
 
diff --git a/csync/src/httpbf/src/httpbf.h b/csync/src/httpbf/src/httpbf.h
index ec1f94e..2d7ea2e 100644
--- a/csync/src/httpbf/src/httpbf.h
+++ b/csync/src/httpbf/src/httpbf.h
@@ -92,6 +92,7 @@ struct hbf_transfer_s {
 
     int64_t stat_size;
     time_t modtime;
+    time_t oc_header_modtime;
     int64_t block_size;
     int64_t threshold;
 
diff --git a/src/mirall/propagator_legacy.cpp b/src/mirall/propagator_legacy.cpp
index d2a243c..7b6a9bf 100644
--- a/src/mirall/propagator_legacy.cpp
+++ b/src/mirall/propagator_legacy.cpp
@@ -95,6 +95,12 @@ void PropagateUploadFileLegacy::start()
 
         state = hbf_splitlist(trans.data(), file.handle());
 
+        // This is the modtime hbf will announce to the server.
+        // We don't trust the modtime hbf computes itself via _fstat64
+        // on windows - hbf may only use it to detect file changes during
+        // upload.
+        trans->oc_header_modtime = FileSystem::getModTime(file.fileName());
+
         // If the source file has changed during upload, it is detected and the
         // variable _previousFileSize is set accordingly. The propagator waits a
         // couple of seconds and retries.
@@ -105,7 +111,7 @@ void PropagateUploadFileLegacy::start()
                                       Q_ARG(qint64, trans->stat_size - _previousFileSize));
             // update the item's values to the current from trans. hbf_splitlist does a stat
             _item._size = trans->stat_size;
-            _item._modtime = trans->modtime;
+            _item._modtime = trans->oc_header_modtime;
 
         }
         emit progress(_item, 0);
@@ -185,7 +191,7 @@ void PropagateUploadFileLegacy::start()
         if( trans->modtime_accepted ) {
             _item._etag = parseEtag(hbf_transfer_etag( trans.data() ));
         } else {
-            if (!updateMTimeAndETag(uri.data(), _item._modtime))
+            if (!updateMTimeAndETag(uri.data(), trans->oc_header_modtime))
                 return;
         }
 
@@ -242,7 +248,7 @@ void PropagateUploadFileLegacy::chunk_finished_cb(hbf_transfer_s *trans, int chu
         pi._valid = true;
         pi._chunk = chunk + 1; // next chunk to start with
         pi._transferid = trans->transfer_id;
-        pi._modtime =  Utility::qDateTimeFromTime_t(trans->modtime);
+        pi._modtime =  Utility::qDateTimeFromTime_t(trans->oc_header_modtime);
         that->_propagator->_journal->setUploadInfo(that->_item._file, pi);
         that->_propagator->_journal->commit("Upload info");
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list