Use QT_LSTAT instead of lstat directly

Not all platforms (such as VxWorks) have lstat.

Change-Id: If42f0041f9a6d9bec0a355173c88f28f1819bd57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Jake Petroules 2017-09-15 02:05:43 -07:00
parent 7127202358
commit 2740b9d668
2 changed files with 6 additions and 4 deletions

View File

@ -28,6 +28,7 @@
#include <QDebug>
#include <QDirIterator>
#include <QString>
#include <qplatformdefs.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>
@ -142,8 +143,8 @@ static int posix_helper(const char *dirpath)
QByteArray ba = dirpath;
ba += '/';
ba += entry->d_name;
struct stat st;
lstat(ba.constData(), &st);
QT_STATBUF st;
QT_LSTAT(ba.constData(), &st);
if (S_ISDIR(st.st_mode))
count += posix_helper(ba.constData());
}

View File

@ -82,6 +82,7 @@
#include <QtCore/qset.h>
#include <QtCore/qstack.h>
#include <QtCore/qvariant.h>
#include <qplatformdefs.h>
#ifdef Q_OS_WIN
# include <windows.h>
@ -343,8 +344,8 @@ bool QFileSystemIteratorPrivate::advanceHelper()
QByteArray ba = m_dirPaths.top();
ba += '/';
ba += name;
struct stat st;
lstat(ba.constData(), &st);
QT_STATBUF st;
QT_LSTAT(ba.constData(), &st);
if (S_ISDIR(st.st_mode)) {
pushSubDirectory(ba);