Revision 3e2cd8ef6f1ce4f46719890134c8bba9dbdb19ba authored by Shawn Rutledge on 11 June 2013, 14:58:49 UTC, committed by The Qt Project on 14 June 2013, 14:57:57 UTC
During a call to QDir::mkpath(), the same path could be created
by another process, in which case the OS mkdir will fail with EEXIST.
But the docs for mkpath() state that it's not an error if it
already exists, whereas for mkdir() it is an error.  So
QFileSystemEngine::createDirectory should accept the EEXIST error
silently if it occurs while creating the sequence of parent directories
and the final leaf directory, but should fail if EEXIST happens when
it was called from QDir::mkdir(), which is when the createParents
parameter is false.  We assume the operating system mkdir() and
CreateDirectory() are atomic, so there should be no race condition
in QDir::mkdir().  It's not necessary for mkpath() to call stat()
at each level, only to check whether an existing entry is a directory
or a file.  Also added to the autotest to verify that if the
path is an existing file, creating a dir with the same name will
fail in either mkdir or mkpath.

Task-number: QTBUG-30046
Change-Id: I926352f10654fdf3b322c8685bb85ad8b8844874
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
1 parent 0bc96d1
History
File Mode Size
bin
config.tests
dist
doc
examples
lib
mkspecs
qmake
src
tests
tools
util
.gitattributes -rw-r--r-- 151 bytes
.gitignore -rw-r--r-- 7.0 KB
.qmake.conf -rw-r--r-- 125 bytes
.tag -rw-r--r-- 12 bytes
INSTALL -rw-r--r-- 574 bytes
LGPL_EXCEPTION.txt -rw-r--r-- 1.2 KB
LICENSE.FDL -rw-r--r-- 22.4 KB
LICENSE.GPL -rw-r--r-- 34.3 KB
LICENSE.LGPL -rw-r--r-- 26.2 KB
LICENSE.PREVIEW.COMMERCIAL -rw-r--r-- 30.8 KB
configure -rwxr-xr-x 227.7 KB
configure.bat -rw-r--r-- 3.7 KB
header.BSD -rw-r--r-- 2.0 KB
header.FDL -rw-r--r-- 1.2 KB
header.LGPL -rw-r--r-- 1.9 KB
header.LGPL-ONLY -rw-r--r-- 958 bytes
qtbase.pro -rw-r--r-- 4.4 KB
sync.profile -rw-r--r-- 3.0 KB

back to top