diff options
Diffstat (limited to 'src/corelib/io/qfile.cpp')
-rw-r--r-- | src/corelib/io/qfile.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index eb6f5be..b6fa5f3 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1386,11 +1386,14 @@ QFile::close() Q_D(QFile); if(!isOpen()) return; - flush(); + bool flushed = flush(); QIODevice::close(); - unsetError(); - if(!fileEngine()->close()) + + // keep earlier error from flush + if (fileEngine()->close() && flushed) + unsetError(); + else if (flushed) d->setError(fileEngine()->error(), fileEngine()->errorString()); } |