diff options
author | Damjan Jovanovic <damjan@apache.org> | 2015-11-03 19:09:04 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-04 14:04:36 +0000 |
commit | 42a63dd0e81f13a84a5f551e03ede685e2bf34c7 (patch) | |
tree | 22928bab99191b8c032f2b728d1e359f37e02ff6 /basic | |
parent | d4d4e00a5a449bdf46608ce0cecbfa07c340e555 (diff) |
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
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/iosys.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index e2b978bfa632..8b84e75e7646 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 ); |