[Libreoffice-commits] core.git: basic/source

Damjan Jovanovic damjan at apache.org
Wed Nov 4 06:05:34 PST 2015


 basic/source/runtime/iosys.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 42a63dd0e81f13a84a5f551e03ede685e2bf34c7
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Tue Nov 3 19:09:04 2015 +0000

    Resolves: #i61277# Basic open file with random access erases all data.
    
    StarBasic tries to emulate truncation of files opened for writing
    by deleting them before opening them (if they exist). However there
    are exclusion to the truncation behaviour when the file is opened
    in append mode or is a binary file. Another exclusion - that was
    missing with disasterous consequences - is that the file should
    not be truncated when opened in random access mode.
    
    (cherry picked from commit 72b2f07ccac7578ef36fc2b92dcba49abe397ebc)
    
    Change-Id: Ic0053039ce5fd67ad42bf5332ae301d83f1a158d

diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index e2b978b..8b84e75 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -582,7 +582,7 @@ SbError SbiStream::Open
         {
 
         // #??? For write access delete file if it already exists (not for appending)
-        if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() &&
+        if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() && !IsRandom() &&
             xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
         {
             xSFI->kill( aNameStr );


More information about the Libreoffice-commits mailing list