From 330df2b3e67159b4fa6d4f27b20af5dfc56d5851 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 16 Mar 2020 10:19:56 +0000 Subject: [PATCH] Fixed a regression opening file handles introduced in e65ac0b --- modules/juce_core/native/juce_posix_SharedCode.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 3afbfcb962..420e7fcf04 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -415,7 +415,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos) void FileInputStream::openHandle() { - auto f = open (file.getFullPathName().toUTF8(), O_CREAT | O_RDONLY, 00644); + auto f = open (file.getFullPathName().toUTF8(), O_RDONLY); if (f != -1) fileHandle = fdToVoidPointer (f); @@ -452,7 +452,7 @@ void FileOutputStream::openHandle() { if (file.exists()) { - auto f = open (file.getFullPathName().toUTF8(), O_CREAT | O_RDWR, 00644); + auto f = open (file.getFullPathName().toUTF8(), O_RDWR); if (f != -1) { @@ -543,8 +543,12 @@ void MemoryMappedFile::openInternal (const File& file, AccessMode mode, bool exc range.setStart (range.getStart() - (range.getStart() % pageSize)); } - fileHandle = open (file.getFullPathName().toUTF8(), - (O_CREAT | (mode == readWrite ? O_RDWR : O_RDONLY)), 00644); + auto filename = file.getFullPathName().toUTF8(); + + if (mode == readWrite) + fileHandle = open (filename, O_CREAT | O_RDWR, 00644); + else + fileHandle = open (filename, O_RDONLY); if (fileHandle != -1) {