From e65ac0b2cda644c5778684caba9a9474b0aa7ac7 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 3 Mar 2020 17:07:39 +0000 Subject: [PATCH] Fixed some warnings when calling open() with file mode bits specified but no O_CREAT flag --- modules/juce_core/native/juce_posix_SharedCode.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 5d30962c43..3afbfcb962 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_RDONLY, 00644); + auto f = open (file.getFullPathName().toUTF8(), O_CREAT | O_RDONLY, 00644); if (f != -1) fileHandle = fdToVoidPointer (f); @@ -452,7 +452,7 @@ void FileOutputStream::openHandle() { if (file.exists()) { - auto f = open (file.getFullPathName().toUTF8(), O_RDWR, 00644); + auto f = open (file.getFullPathName().toUTF8(), O_CREAT | O_RDWR, 00644); if (f != -1) { @@ -475,7 +475,7 @@ void FileOutputStream::openHandle() } else { - auto f = open (file.getFullPathName().toUTF8(), O_RDWR + O_CREAT, 00644); + auto f = open (file.getFullPathName().toUTF8(), O_RDWR | O_CREAT, 00644); if (f != -1) fileHandle = fdToVoidPointer (f); @@ -544,7 +544,7 @@ void MemoryMappedFile::openInternal (const File& file, AccessMode mode, bool exc } fileHandle = open (file.getFullPathName().toUTF8(), - mode == readWrite ? (O_CREAT + O_RDWR) : O_RDONLY, 00644); + (O_CREAT | (mode == readWrite ? O_RDWR : O_RDONLY)), 00644); if (fileHandle != -1) {