Only initially open files as writable if they actually should be.
This commit is contained in:
parent
beb3b20d5e
commit
b746c0b727
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue