From 280f9fb7289fb189c806d0a0854d6cf30c0a14d8 Mon Sep 17 00:00:00 2001 From: Gerardo Ganis <Gerardo.Ganis@cern.ch> Date: Tue, 24 Jan 2017 12:37:52 +0100 Subject: [PATCH] io/io: fix for ROOT-8516 (corruption in file writing) When the write-cache required flushing to file and the length of the buffer to be written exceed the size of the cache buffer, requiring direct-write-to-file, the offset (seek position) was incorrectly left to the one of the last basket in the flushed cache. --- io/io/src/TFileCacheWrite.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/io/io/src/TFileCacheWrite.cxx b/io/io/src/TFileCacheWrite.cxx index 5cdd1d8f547..f9bdf341465 100644 --- a/io/io/src/TFileCacheWrite.cxx +++ b/io/io/src/TFileCacheWrite.cxx @@ -133,6 +133,7 @@ Int_t TFileCacheWrite::WriteBuffer(const char *buf, Long64_t pos, Int_t len) if (len >= fBufferSize) { //buffer larger than the cache itself: direct write to file fRecursive = kTRUE; + fFile->Seek(pos); // Flush may have changed this if (fFile->WriteBuffer(buf,len)) return -1; // failure fRecursive = kFALSE; return 1; -- GitLab