summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-04-15 12:30:47 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-05-22 12:33:40 (GMT)
commit3580f5b4d002cca714d443054f8cdd6aefca3287 (patch)
treedacfe1af20d4cd90c141300dce8f147616068ffe
parentfd7cb7faa765835de6e7beb24f018c417d9ad7d8 (diff)
downloadQt-3580f5b4d002cca714d443054f8cdd6aefca3287.zip
Qt-3580f5b4d002cca714d443054f8cdd6aefca3287.tar.gz
Qt-3580f5b4d002cca714d443054f8cdd6aefca3287.tar.bz2
QFile::rename fallback: reset permissions and error state on success
Fallback implementation for rename operation should try to copy permissions from the original file to the destination file. Note that failures at this point are not treated as errors. Errors previously set by the native fileEngine are also reset before returning. Reviewed-by: Peter Hartmann Reviewed-by: Thiago
-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 a0bd8b4..10b812b 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -748,8 +748,11 @@ QFile::rename(const QString &newName)
}
if (error)
out.remove();
- else
+ else {
+ setPermissions(permissions());
+ unsetError();
setFileName(newName);
+ }
close();
return !error;
}