Fix QStorageInfo in devel/qt5-core.

QStorageInfo did not return any valid data on FreeBSD.

Add upstreamed patch:
   getmntinfo() was wrongly called with flag 0. This changes it to use MNT_NOWAIT.

PR:		220941
This commit is contained in:
Tobias C. Berner 2017-07-23 10:56:02 +00:00
parent c6a9fc08d5
commit f909924636
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=446462
2 changed files with 38 additions and 1 deletions

View file

@ -2,7 +2,7 @@
PORTNAME= core
DISTVERSION= ${QT5_VERSION}
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel
PKGNAMEPREFIX= qt5-

View file

@ -0,0 +1,37 @@
From fa3940cc4b5580070f465d1f64a23a69bc925367 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Mon, 29 May 2017 14:00:53 -0700
Subject: [PATCH] QStorageInfo: Pass MNT_NOWAIT to getmntinfo
This forces the API not to wait for synchronous I/O from the filesystems
and get the information, but instead just use the cached information
directly. It's a good idea if we have an unresponsive FS, like NFS with
an unreachable server.
Task-number: QTBUG-61096
Change-Id: Iddeeffb6f4ad4a2894a2fffd14c32f6e90664a63
Reviewed-by: Tobias C. Berner
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
---
src/corelib/io/qstorageinfo_unix.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git src/corelib/io/qstorageinfo_unix.cpp src/corelib/io/qstorageinfo_unix.cpp
index b9c9883609..9072b34f54 100644
--- src/corelib/io/qstorageinfo_unix.cpp
+++ src/corelib/io/qstorageinfo_unix.cpp
@@ -195,8 +195,12 @@ static bool shouldIncludeFs(const QStorageIterator &it)
#if defined(Q_OS_BSD4)
+#ifndef MNT_NOWAIT
+# define MNT_NOWAIT 0
+#endif
+
inline QStorageIterator::QStorageIterator()
- : entryCount(::getmntinfo(&stat_buf, 0)),
+ : entryCount(::getmntinfo(&stat_buf, MNT_NOWAIT)),
currentIndex(-1)
{
}