From fb3072bbbb64e51bebdecbd6ab44fe0b1694ba9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramon=20Buld=C3=B3?= Date: Sat, 28 Feb 2015 16:44:09 +0100 Subject: [PATCH] /etc/mtab reports a file size of 0, so using .atEnd() may not work. Read the file until it doesn't return more data. Use QTextStream because it takes care of the conversion between 8-bit and 16-bit. http://doc.qt.io/qt-5/qfile.html#using-streams-to-read-files --- src/modules/partition/jobs/ClearTempMountsJob.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/partition/jobs/ClearTempMountsJob.cpp b/src/modules/partition/jobs/ClearTempMountsJob.cpp index 23d484f0c..043dddb84 100644 --- a/src/modules/partition/jobs/ClearTempMountsJob.cpp +++ b/src/modules/partition/jobs/ClearTempMountsJob.cpp @@ -49,10 +49,11 @@ ClearTempMountsJob::exec() return Calamares::JobResult::error( tr( "Cannot get list of temporary mounts." ) ); cDebug() << "Opened mtab. Lines:"; - while ( !mtab.atEnd() ) + QTextStream in(&mtab); + QString lineIn = in.readLine(); + while ( !lineIn.isNull() ) { - QStringList line = QString::fromLocal8Bit( mtab.readLine() ) - .split( ' ', QString::SkipEmptyParts ); + QStringList line = lineIn.split( ' ', QString::SkipEmptyParts ); cDebug() << line.join( ' ' ); QString device = line.at( 0 ); QString mountPoint = line.at( 1 ); @@ -61,6 +62,7 @@ ClearTempMountsJob::exec() cDebug() << "INSERTING pair (device, mountPoint)" << device << mountPoint; lst.append( qMakePair( device, mountPoint ) ); } + lineIn = in.readLine(); } qSort( lst.begin(), lst.end(), []( const QPair< QString, QString >& a,