Browse Source

Fixed some warnings when calling open() with file mode bits specified but no O_CREAT flag

tags/2021-05-28
ed 5 years ago
parent
commit
e65ac0b2cd
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      modules/juce_core/native/juce_posix_SharedCode.h

+ 4
- 4
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -415,7 +415,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos)
void FileInputStream::openHandle() 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) if (f != -1)
fileHandle = fdToVoidPointer (f); fileHandle = fdToVoidPointer (f);
@@ -452,7 +452,7 @@ void FileOutputStream::openHandle()
{ {
if (file.exists()) 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) if (f != -1)
{ {
@@ -475,7 +475,7 @@ void FileOutputStream::openHandle()
} }
else 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) if (f != -1)
fileHandle = fdToVoidPointer (f); fileHandle = fdToVoidPointer (f);
@@ -544,7 +544,7 @@ void MemoryMappedFile::openInternal (const File& file, AccessMode mode, bool exc
} }
fileHandle = open (file.getFullPathName().toUTF8(), 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) if (fileHandle != -1)
{ {


Loading…
Cancel
Save