diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2012-10-29 10:48:12 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-31 00:03:22 (GMT) |
commit | 2d652e9a00ad448047d58184512d93d4cfdb55f3 (patch) | |
tree | fa50483f3b0fb6323dca649254a7503dcc40eeec /src | |
parent | a5e13ebb6080053dc65be30ad8e51010c496fea6 (diff) | |
download | Qt-2d652e9a00ad448047d58184512d93d4cfdb55f3.zip Qt-2d652e9a00ad448047d58184512d93d4cfdb55f3.tar.gz Qt-2d652e9a00ad448047d58184512d93d4cfdb55f3.tar.bz2 |
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.
This is a backport of
qtbase commit 03cd922e312428aca54892039da9ed79479cfa17
Change-Id: I5ef10c369ce6790c8d0de1346436f9ea7aaa4194
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystemengine.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp index 2102837..02b7aba 100644 --- a/src/corelib/io/qfilesystemengine.cpp +++ b/src/corelib/io/qfilesystemengine.cpp @@ -312,6 +312,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. |