summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorDamjan Jovanovic <damjan@apache.org>2015-11-03 19:09:04 +0000
committerDamjan Jovanovic <damjan@apache.org>2015-11-03 19:09:04 +0000
commit72b2f07ccac7578ef36fc2b92dcba49abe397ebc (patch)
tree228b6ddf2980a4dad5987836dec4afe66cea878d /basic
parent72581356c8c6443e05843b3292504049de347885 (diff)
#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.
Notes
Notes: merged as: 42a63dd0e81f13a84a5f551e03ede685e2bf34c7
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/iosys.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 70c24382183e..f404c2a9f59f 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -665,7 +665,7 @@ SbError SbiStream::Open
{
// #??? For write access delete file if it already exists (not for appending)
- if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() &&
+ if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() && !IsRandom() &&
xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
{
xSFI->kill( aNameStr );