From c5e6034bbd99459373279f8ae3dcac0f87c1f39c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 6 Jun 2025 16:16:10 -0300 Subject: [PATCH] QFileSystemEngine/Linux: correct a minor problem with lstatx() failures Our wrappers around the statx(2) system call on Linux return the negative of errno, to avoid setting errno and reading it back for the OSes where the system call doesn't apply. That means the vast majority of errors from qt_lstatx() will not be -1 (the most common being -2 for ENOENT) and we'd thus not enter the next block: // second, we try a regular stat(2) if (statResult == -1 && (what & QFileSystemMetaData::PosixStatFlags)) { Pick-to: 6.10 6.9 6.8 Change-Id: I489e7c9ee1327fb98510fffd315c66948956534f Reviewed-by: Ahmad Samir Reviewed-by: Edward Welbourne --- src/corelib/io/qfilesystemengine_unix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index c02fb102247..c594978a09e 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -963,6 +963,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } else { // it doesn't exist entryErrno = errno; + statResult = -1; data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; } @@ -971,7 +972,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM // second, we try a regular stat(2) if (statResult == -1 && (what & QFileSystemMetaData::PosixStatFlags)) { - if (entryErrno == 0 && statResult == -1) { + if (entryErrno == 0) { data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags; statResult = qt_statx(nativeFilePath, &statxBuffer); if (statResult == -ENOSYS) {