diff options
Diffstat (limited to 'src/corelib/io/qfilesystemiterator_unix.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemiterator_unix.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp index 0b59aa169a..0f9bbd8a29 100644 --- a/src/corelib/io/qfilesystemiterator_unix.cpp +++ b/src/corelib/io/qfilesystemiterator_unix.cpp @@ -70,7 +70,7 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi if (!nativePath.endsWith('/')) nativePath.append('/'); -#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) || defined(QT_EXT_QNX_READDIR_R) // ### Race condition; we should use fpathconf and dirfd(). size_t maxPathName = ::pathconf(nativePath.constData(), _PC_NAME_MAX); if (maxPathName == size_t(-1)) @@ -81,13 +81,14 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi Q_CHECK_PTR(p); mt_file.reset(p); -#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R) +#if defined(QT_EXT_QNX_READDIR_R) direntSize = maxPathName; - // Include extra stat information in the readdir() call (d_stat member of dirent_extra_stat). - // This is used in QFileSystemMetaData::fillFromDirEnt() to avoid extra stat() calls when iterating - // over directories - if (dircntl(dir, D_SETFLAG, D_FLAG_STAT) == -1) + // Include extra stat information in the readdir() call (d_stat member of + // dirent_extra_stat). This is used in QFileSystemMetaData::fillFromDirEnt() to + // avoid extra stat() calls when iterating over directories + int flags = dircntl(dir, D_GETFLAG) | D_FLAG_STAT | D_FLAG_FILTER; + if (dircntl(dir, D_SETFLAG, flags) == -1) lastError = errno; #endif #endif @@ -105,7 +106,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa if (!dir) return false; -#if defined(Q_OS_QNX) && defined(QT_EXT_QNX_READDIR_R) +#if defined(QT_EXT_QNX_READDIR_R) lastError = QT_EXT_QNX_READDIR_R(dir, mt_file.data(), &dirEntry, direntSize); if (lastError) return false; |