summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qdiriterator.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index eae1dfa..6d6542f 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -235,15 +235,14 @@ bool QDirIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo)
if (!fileInfo.isDir())
return false;
- // Never follow . and ..
- if (fileInfo.fileName() == QLatin1String(".") || fileInfo.fileName() == QLatin1String(".."))
+ // Follow symlinks only when asked
+ if (!(iteratorFlags & QDirIterator::FollowSymlinks) && fileInfo.isSymLink())
return false;
- // Check symlinks
- if (!(iteratorFlags & QDirIterator::FollowSymlinks) && fileInfo.isSymLink()) {
- // Follow symlinks only if FollowSymlinks was passed
+ // Never follow . and ..
+ QString fileName = fileInfo.fileName();
+ if (QLatin1String(".") == fileName || QLatin1String("..") == fileName)
return false;
- }
// Stop link loops
if (visitedLinks.contains(fileInfo.canonicalFilePath()))