From da8c3e580764c0aadc911e26c830970be7233be0 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 24 Mar 2015 20:17:17 +0100 Subject: [PATCH] Hurd: Implement QStorageInfo for Hurd Make use of the Linux implementation for Hurd as well, as the mntent API is available there too (including getmntent_r, specific to GNU libc). Since PATH_MAX is not available on Hurd, and the current bufferSize is a lot more larger than it is needed, restrict bufferSize to 1024 bytes, which should be enough to cover 3 paths in mtab and it is usually used also in other projects. Change-Id: Ied43be2ab1eb95b48eb9f55a92064e7549efaefd Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qstorageinfo_unix.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 45b32830cd7..d120d7569a5 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -49,7 +49,7 @@ # include # include # include -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) # include # include #elif defined(Q_OS_SOLARIS) @@ -133,7 +133,7 @@ private: QByteArray m_rootPath; QByteArray m_fileSystemType; QByteArray m_device; -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) FILE *fp; mntent mnt; QByteArray buffer; @@ -275,10 +275,11 @@ inline QByteArray QStorageIterator::device() const return m_device; } -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) static const char pathMounted[] = "/etc/mtab"; -static const int bufferSize = 3*PATH_MAX; // 2 paths (mount point+device) and metainfo +static const int bufferSize = 1024; // 2 paths (mount point+device) and metainfo; + // should be enough inline QStorageIterator::QStorageIterator() : buffer(QByteArray(bufferSize, 0))