From 23870b3cad0463c9a98005a3c661188d0f7b7b2c Mon Sep 17 00:00:00 2001 From: Johannes Rosenqvist Date: Sun, 29 Apr 2018 21:59:54 +0200 Subject: [PATCH] Fix QStorageIterator where the last line in /proc/mounts is skipped On Android systems QStorageIterator uses /proc/mounts to parse mounted volumes. For every call to QStorageIterator::next() a check was done to see if we had reached EOF with atEnd(), but didn't take account of the last call to file.readLine(), which might contain a valid entry. [ChangeLog][QtCore][QStorageInfo] Fixed a bug that caused the last entry in the mtab file to be ignored on Android. Task-number: QTBUG-60215 Change-Id: I064452002922c72ffa1c8954fec5f28738c42bae Reviewed-by: Thiago Macieira --- src/corelib/io/qstorageinfo_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 7664b77d814..15d78cb9853 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -347,7 +347,7 @@ inline bool QStorageIterator::next() data = line.split(' '); } while (data.count() < 3 && !file.atEnd()); - if (file.atEnd()) + if (file.atEnd() && data.count() <= 3) return false; m_device = data.at(0); m_rootPath = data.at(1);