aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNadia Holmquist Pedersen <nadia@nhp.sh>2020-05-06 03:53:05 +0200
committerNadia Holmquist Pedersen <nadia@nhp.sh>2020-05-06 03:53:05 +0200
commitb746c0b7279d1f5b4bcfd02c115b09d583e9df4f (patch)
tree03ebd3f8a7fe7c78bdf13c3329949fffa73f4489 /src
parentbeb3b20d5e85f9d58017684dc0abc39a0352f2f4 (diff)
Only initially open files as writable if they actually should be.
Diffstat (limited to 'src')
-rw-r--r--src/frontend/qt_sdl/Platform.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp
index 7ce70ab..125e7ea 100644
--- a/src/frontend/qt_sdl/Platform.cpp
+++ b/src/frontend/qt_sdl/Platform.cpp
@@ -85,7 +85,9 @@ FILE* OpenFile(const char* path, const char* mode, bool mustexist)
return nullptr;
}
- f.open(QIODevice::ReadWrite);
+ QIODevice::OpenMode qmode = mode[0] == 'w' ? QIODevice::ReadWrite : QIODevice::ReadOnly;
+
+ f.open(qmode);
FILE* file = fdopen(dup(f.handle()), mode);
f.close();