From 4db90501b020a77a159d09ada1a0740e4745616d Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 27 Dec 2020 00:19:07 +0000 Subject: [PATCH] use S_IS* macros instead of S_IF* constants according to https://linux.die.net/man/2/stat the S_IF* constants are present in POSIX.1-2001 and later, POSIX.1-1990 demands the use of macros Signed-off-by: Ivailo Monev --- src/core/io/qfilesystemengine_unix.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/io/qfilesystemengine_unix.cpp b/src/core/io/qfilesystemengine_unix.cpp index 35ce32bd5..2ebb3d743 100644 --- a/src/core/io/qfilesystemengine_unix.cpp +++ b/src/core/io/qfilesystemengine_unix.cpp @@ -262,7 +262,7 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea const QByteArray chunk = QFile::encodeName(dirName.left(slash)); QT_STATBUF st; if (QT_STAT(chunk.constData(), &st) == 0) { - if ((st.st_mode & S_IFMT) != S_IFDIR) + if (!S_ISDIR(st.st_mode)) return false; } else if (QT_MKDIR(chunk.constData(), 0777) != 0) { return false; @@ -284,7 +284,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo const QByteArray chunk = QFile::encodeName(dirName.left(slash)); QT_STATBUF st; if (QT_STAT(chunk.constData(), &st) == 0) { - if ((st.st_mode & S_IFMT) != S_IFDIR) + if (!S_ISDIR(st.st_mode)) return false; if (::rmdir(chunk.constData()) != 0) return oldslash != 0; @@ -538,9 +538,9 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer) entryFlags |= QFileSystemMetaData::OtherExecutePermission; // Type - if ((statBuffer.st_mode & S_IFMT) == S_IFREG) + if (S_ISREG(statBuffer.st_mode)) entryFlags |= QFileSystemMetaData::FileType; - else if ((statBuffer.st_mode & S_IFMT) == S_IFDIR) + else if (S_ISDIR(statBuffer.st_mode)) entryFlags |= QFileSystemMetaData::DirectoryType; else entryFlags |= QFileSystemMetaData::SequentialType; -- 2.11.0