Skip to content

Commit

Permalink
Use QT_LSTAT instead of lstat directly
Browse files Browse the repository at this point in the history
Not all platforms (such as VxWorks) have lstat.

Change-Id: If42f0041f9a6d9bec0a355173c88f28f1819bd57
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
jakepetroules committed Sep 15, 2017
1 parent 7127202 commit 2740b9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/benchmarks/corelib/io/qdiriterator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <QDebug>
#include <QDirIterator>
#include <QString>
#include <qplatformdefs.h>

#ifdef Q_OS_WIN
# include <qt_windows.h>
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2740b9d

Please sign in to comment.