summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-04-02 11:15:03 +0200
committerJoão Abecasis <joao@abecasis.name>2009-04-02 16:29:48 +0200
commit57ec397f66e611c7802c8cdbb8a0232b91ac78f5 (patch)
tree785cc36656fd23b2f6a344ad2c5619e029a4b0f7 /src/corelib
parent8d50038174faf315a389010af3a680d865f6843a (diff)
Delete temporary file if copy was unsuccessful
This is an untested bugfix -- comes solely from reading the code. In QFile::copy's fallback implementation a (temporary) file is created for block copying from the source file. When Qt is built without temporary file support this doesn't seem to be deleted in case of an error while block copying or renaming to the final destination. Reviewed-by: mariusSO
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index f0a6676507..d7da800860 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -900,7 +900,10 @@ QFile::copy(const QString &newName)
error = true;
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
}
-#ifndef QT_NO_TEMPORARYFILE
+#ifdef QT_NO_TEMPORARYFILE
+ if (error)
+ out.remove();
+#else
if (!error)
out.setAutoRemove(false);
#endif