Details
Description
If renaming a file (using QFile::rename) fails, Error String (QIODevice::errorString) may be wrong because reset at the end of the method.
Faulty Line is the following:
d->setError(QFile::RenameError, out.isOpen() ? errorString() : out.errorString());
I suppose condition is reversed, because at this time, current errorString is good.
Although, I'm still using Qt 5.6.2, it does not seem to be fixed in unreleased Qt 5.11
https://github.com/qt/qtbase/blob/5.11/src/corelib/io/qfile.cpp#L680
I should get "Accès refusé." (Access is Denied.) but get "Unknown error" instead which is the default one provided by Qt when errorString is empty (which is the case for closed QFile out).
To reproduce, just try to rename an already opened file. If desired, I can write an example reproducing this.