From 6de55e6951fd0956bcbd44b60714dad686132050 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 2 Nov 2018 12:13:29 -0400 Subject: [PATCH] [partition] Construct, then winnow, the fstab entries --- src/modules/partition/core/PartUtils.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index e9d15ebb6..e696a0569 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -175,25 +175,9 @@ lookForFstabEntries( const QString& partitionPath ) .split( '\n' ); for ( const QString& rawLine : fstabLines ) - { - QString line = rawLine.simplified(); - if ( line.startsWith( '#' ) ) - continue; - - QStringList splitLine = line.split( ' ' ); - if ( splitLine.length() != 6 ) - continue; - - fstabEntries.append( { splitLine.at( 0 ), // path, or UUID, or LABEL, etc. - splitLine.at( 1 ), // mount point - splitLine.at( 2 ), // fs type - splitLine.at( 3 ), // options - splitLine.at( 4 ).toInt(), //dump - splitLine.at( 5 ).toInt() //pass - } ); - } - + fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) ); fstabFile.close(); + std::remove_if( fstabEntries.begin(), fstabEntries.end(), [](const FstabEntry& x) { return !x.isValid(); } ); } if ( QProcess::execute( "umount", { "-R", mountsDir.path() } ) )