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 <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2025-06-06 16:16:10 -03:00
parent 07d3d3935c
commit c5e6034bbd

View File

@ -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) {