diff options
author | João Abecasis <joao@abecasis.name> | 2009-04-02 09:15:03 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-04-02 14:29:48 (GMT) |
commit | 57ec397f66e611c7802c8cdbb8a0232b91ac78f5 (patch) | |
tree | 785cc36656fd23b2f6a344ad2c5619e029a4b0f7 /src/corelib/io | |
parent | 8d50038174faf315a389010af3a680d865f6843a (diff) | |
download | Qt-57ec397f66e611c7802c8cdbb8a0232b91ac78f5.zip Qt-57ec397f66e611c7802c8cdbb8a0232b91ac78f5.tar.gz Qt-57ec397f66e611c7802c8cdbb8a0232b91ac78f5.tar.bz2 |
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/io')
-rw-r--r-- | src/corelib/io/qfile.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index f0a6676..d7da800 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 |