From b746c0b7279d1f5b4bcfd02c115b09d583e9df4f Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Wed, 6 May 2020 03:53:05 +0200 Subject: Only initially open files as writable if they actually should be. --- src/frontend/qt_sdl/Platform.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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(); -- cgit v1.2.3