QFile::rename: error out if overwrite fails when changing case on case-insensitive filesystems
The generic copy-and-remove fallback will first open the original file with a different case, truncate it, and then remove the original file. Leaving us with no file at all. Task-number: QTBUG-132785 Pick-to: 6.8 6.5 Change-Id: Ia5a41d26c1d6d6bdc231c71acf15bd2ea496c715 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 2defca418788ab167fa1ce70e518c9250cb0909f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e958f05aec
commit
ce820174ee
@ -654,6 +654,13 @@ QFile::rename(const QString &newName)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Engine was unable to rename and the fallback will delete the original file,
|
||||||
|
// so we have to back out here on case-insensitive file systems:
|
||||||
|
if (changingCase) {
|
||||||
|
d->setError(QFile::RenameError, d->fileEngine->errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isSequential()) {
|
if (isSequential()) {
|
||||||
d->setError(QFile::RenameError, tr("Will not rename sequential file using block copy"));
|
d->setError(QFile::RenameError, tr("Will not rename sequential file using block copy"));
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user