diff options
Diffstat (limited to 'src/corelib/io/qstorageinfo_unix.cpp')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 6d8b6ee1a0..7664b77d81 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -108,6 +108,13 @@ # endif // QT_LARGEFILE_SUPPORT #endif // Q_OS_BSD4 +#if QT_HAS_INCLUDE(<paths.h>) +# include <paths.h> +#endif +#ifndef _PATH_MOUNTED +# define _PATH_MOUNTED "/etc/mnttab" +#endif + QT_BEGIN_NAMESPACE class QStorageIterator @@ -274,11 +281,9 @@ inline QByteArray QStorageIterator::subvolume() const } #elif defined(Q_OS_SOLARIS) -static const char pathMounted[] = "/etc/mnttab"; - inline QStorageIterator::QStorageIterator() { - const int fd = qt_safe_open(pathMounted, O_RDONLY); + const int fd = qt_safe_open(_PATH_MOUNTED, O_RDONLY); fp = ::fdopen(fd, "r"); } @@ -319,11 +324,9 @@ inline QByteArray QStorageIterator::subvolume() const } #elif defined(Q_OS_ANDROID) -static const QLatin1String pathMounted("/proc/mounts"); - inline QStorageIterator::QStorageIterator() { - file.setFileName(pathMounted); + file.setFileName(_PATH_MOUNTED); file.open(QIODevice::ReadOnly | QIODevice::Text); } @@ -380,7 +383,6 @@ inline QByteArray QStorageIterator::subvolume() const } #elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) -static const char pathMounted[] = "/etc/mtab"; static const int bufferSize = 1024; // 2 paths (mount point+device) and metainfo; // should be enough @@ -397,7 +399,7 @@ inline QStorageIterator::QStorageIterator() : usingMountinfo = true; } else { usingMountinfo = false; - fp = ::setmntent(pathMounted, "r"); + fp = ::setmntent(_PATH_MOUNTED, "r"); } } |