summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2012-10-29 12:00:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-30 12:53:46 +0100
commit03cd922e312428aca54892039da9ed79479cfa17 (patch)
tree0e3e92ed3f9f1dffc80b31fe3ee75a682c8c97f0 /src
parentd402d0c3e3f177976d31bd7822a735e535562871 (diff)
QNX: Remember information on whether a file is a link
This avoids an additional call to lstat() When using QDir::entryList() with the QDir::NoSymLinks flag. Change-Id: I3b602546c6a4502ae25a5748a12c60e69325bb5d Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: João Abecasis <joao@abecasis.name>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qfilesystemengine.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index fe06210fb9..8707aec0b8 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -300,6 +300,13 @@ void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
const struct dirent_extra_stat * const extra_stat =
reinterpret_cast<struct dirent_extra_stat *>(extra);
+ // Remember whether this was a link or not, this saves an lstat() call later.
+ if (extra->d_type == _DTYPE_LSTAT) {
+ knownFlagsMask |= QFileSystemMetaData::LinkType;
+ if (S_ISLNK(extra_stat->d_stat.st_mode))
+ entryFlags |= QFileSystemMetaData::LinkType;
+ }
+
// For symlinks, the extra type _DTYPE_LSTAT doesn't work for filling out the meta data,
// as we need the stat() information there, not the lstat() information.
// In this case, don't use the extra information.