From 8bc95d78ae9e803ddf4d20fe289cac881c525ced Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 28 Apr 2024 20:48:02 +0200 Subject: [PATCH] Limit Linux-only code with Q_OS_LINUX Forwarded: no Last-Update: 2020-04-19 The QStorageInfo/QStorageIterator implementation used for Linux is used also on Hurd, as it uses an interface provided by GNU libc. QStorageIterator::device() tries to use PATH_MAX (unavailable on the Hurd) to lookup a /dev/block/ path, which exists on Linux only; hence, perform that check within a Q_OS_LINUX block. Gbp-Pq: Name qstorageinfo_linux.diff --- src/corelib/io/qstorageinfo_unix.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 698c4ddf4..45570eeea 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -566,6 +566,7 @@ inline QByteArray QStorageIterator::fileSystemType() const inline QByteArray QStorageIterator::device() const { +#ifdef Q_OS_LINUX // check that the device exists if (mnt.mnt_fsname[0] == '/' && access(mnt.mnt_fsname, F_OK) != 0) { // It doesn't, so let's try to resolve the dev_t from /dev/block. @@ -581,6 +582,7 @@ inline QByteArray QStorageIterator::device() const return dev; } } +#endif return QByteArray(mnt.mnt_fsname); } -- 2.30.2