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 <thiago.macieira@intel.com>
This commit is contained in:
Johannes Rosenqvist 2018-04-29 21:59:54 +02:00 committed by Edward Welbourne
parent 89f7e090ef
commit 23870b3cad

View File

@ -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);