diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-01-20 09:34:42 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2015-01-22 08:31:54 +0100 |
commit | 508b1fa173e135c839f07e0e4cd6009ac63a577c (patch) | |
tree | dde8a0dbf1d1e168897607666f01645084a08666 /src/corelib | |
parent | 9e4ef3539a5770f1b422b73b41dc3218ff4efc81 (diff) |
QTemporaryDir: Remove directories on failure
When creating a temporary directory but failing to set its permissions,
we need to remove the directory we created to avoid leaving 256 empty,
unused directories in the destination folder.
This happens on Android if you try creating a QTemporaryDir in the
download path on the sdcard.
Task-number: QTBUG-43352
Change-Id: Ic88fb7572f1abd65e5c7d8882b59c95f4b22ed72
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qtemporarydir.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 5e0def74ee..5f0c500183 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -128,8 +128,11 @@ static char *q_mkdtemp(char *templateName) QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner, error); - if (error.error() != 0) + if (error.error() != 0) { + if (!QFileSystemEngine::removeDirectory(fileSystemEntry, false)) + qWarning() << "Unable to remove unused directory" << templateNameStr; continue; + } return templateName; } } |