Do not report wrong mountpoint for closed LUKS file systems.
When libparted scans luks partitions it calls detectFileSystem regardless of whether luks is open or closed. This results in mapperNode being empty, so we need to prevent detectFileSystem from reporting anything in this case.
This commit is contained in:
parent
f29534e7c7
commit
95a74c63d1
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QStorageInfo>
|
||||
|
||||
|
@ -130,12 +131,16 @@ QString FileSystem::detectMountPoint(FileSystem* fs, const QString& partitionPat
|
|||
if (fs->type() == FileSystem::Lvm2_PV)
|
||||
return FS::lvm2_pv::getVGName(partitionPath);
|
||||
|
||||
if (partitionPath.isEmpty()) // Happens when during initial scan LUKS is closed
|
||||
return QString();
|
||||
|
||||
QStringList mountPoints;
|
||||
QFileInfo kernelPath(partitionPath);
|
||||
QFileInfo partitionPathFileInfo(partitionPath);
|
||||
const QList<QStorageInfo> mountedVolumes = QStorageInfo::mountedVolumes();
|
||||
for (const QStorageInfo &storage : mountedVolumes) {
|
||||
QFileInfo kernelPath2(QString::fromUtf8(storage.device()));
|
||||
if (kernelPath2.canonicalFilePath() == kernelPath.canonicalFilePath() ) {
|
||||
QFileInfo deviceFileInfo(QString::fromUtf8(storage.device()));
|
||||
qDebug() << storage.device() << storage.rootPath();
|
||||
if (partitionPathFileInfo.canonicalFilePath() == deviceFileInfo.canonicalFilePath() ) {
|
||||
mountPoints.append(storage.rootPath());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue