From b30f1284b6c2eb6c600900eee0851a93923ba7eb Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 29 Dec 2019 06:04:16 +0000 Subject: [PATCH] make stat() error checks consisten in QFileSystemEngine::createDirectory(), QFileSystemEngine::removeDirectory() and QFileSystemEngine::copyFile() Signed-off-by: Ivailo Monev --- src/core/io/qfilesystemengine_unix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/io/qfilesystemengine_unix.cpp b/src/core/io/qfilesystemengine_unix.cpp index e359990ea..38c275db5 100644 --- a/src/core/io/qfilesystemengine_unix.cpp +++ b/src/core/io/qfilesystemengine_unix.cpp @@ -321,7 +321,7 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea if (slash) { const char* chunk = QFile::encodeName(dirName.left(slash)).constData(); QT_STATBUF st; - if (QT_STAT(chunk, &st) != -1) { + if (QT_STAT(chunk, &st) == 0) { if ((st.st_mode & S_IFMT) != S_IFDIR) return false; } else if (QT_MKDIR(chunk, 0777) != 0) { @@ -343,7 +343,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) { const char* chunk = QFile::encodeName(dirName.left(slash)).constData(); QT_STATBUF st; - if (QT_STAT(chunk, &st) != -1) { + if (QT_STAT(chunk, &st) == 0) { if ((st.st_mode & S_IFMT) != S_IFDIR) return false; if (::rmdir(chunk) != 0) @@ -381,7 +381,7 @@ bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSyst #endif QT_STATBUF st; - if (QT_STAT(source.nativeFilePath().constData(), &st) != -1) { + if (QT_STAT(source.nativeFilePath().constData(), &st) == 0) { if (!S_ISREG(st.st_mode)) return false; } -- 2.11.0