summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine_win.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-07-01 14:38:55 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-07-20 01:17:28 +0000
commitcb9b42b493d168544ec8e4d6ff10c74cbdc70942 (patch)
treef6f1194d63ab188a7703bae522b0fbc185119cc7 /src/corelib/io/qfsfileengine_win.cpp
parenta639a4cc075bea7f55171ebca786cb46e72e34f3 (diff)
QFileSystemEngine: a file only exists if its link count is not 0
QFileSystemMetaData::fillFromStatBuf is used when filling in the results from both stat() as well as fstat(). Obviously the file exists if it was stat()ed but not necessarily so by fstat(): we could be operating on a file descriptor referring to an unlinked file or an O_TMPFILE. Change-Id: I8d96dea9955d4c749b99fffd14cd52a8c8dd9ca1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/io/qfsfileengine_win.cpp')
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index d749e32447..6d8db1a72e 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -741,6 +741,8 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(QAbstractFileEngine::Fil
}
if (type & FlagsMask) {
if (d->metaData.exists()) {
+ // if we succeeded in querying, then the file exists: a file on
+ // Windows cannot be deleted if we have an open handle to it
ret |= ExistsFlag;
if (d->fileEntry.isRoot())
ret |= RootFlag;