diff --git a/src/core/fstab.cpp b/src/core/fstab.cpp index da66235..0a6b947 100644 --- a/src/core/fstab.cpp +++ b/src/core/fstab.cpp @@ -104,14 +104,12 @@ FstabEntryList readFstabEntries( const QString& fstabPath ) QStringList possibleMountPoints(const QString& deviceNode, const QString& fstabPath) { QStringList mountPoints; - QFileInfo kernelPath(deviceNode); - QString canonicalPath = kernelPath.canonicalFilePath(); + QString canonicalPath = QFileInfo(deviceNode).canonicalFilePath(); const FstabEntryList fstabEntryList = readFstabEntries( fstabPath ); - for (const FstabEntry &entry : fstabEntryList) { - QFileInfo kernelPath2(entry.deviceNode()); - if (kernelPath2.canonicalFilePath() == canonicalPath) + for (const FstabEntry &entry : fstabEntryList) + if (QFileInfo(entry.deviceNode()).canonicalFilePath() == canonicalPath) mountPoints.append(entry.mountPoint()); - } + return mountPoints; } diff --git a/src/core/partition.cpp b/src/core/partition.cpp index c42febe..405f583 100644 --- a/src/core/partition.cpp +++ b/src/core/partition.cpp @@ -332,9 +332,10 @@ bool Partition::unmount(Report& report) success = fileSystem().unmount(report, deviceNode()); } + const QString canonicalDeviceNode = QFileInfo(deviceNode()).canonicalFilePath(); const QList mountedVolumes = QStorageInfo::mountedVolumes(); for (const QStorageInfo &storage : mountedVolumes) { - if (QString::fromUtf8(storage.device()) == deviceNode() ) { + if (QFileInfo(QString::fromUtf8(storage.device())).canonicalFilePath() == canonicalDeviceNode ) { success = false; break; } diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 57e6105..66d6535 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -135,10 +135,10 @@ QString FileSystem::detectMountPoint(FileSystem* fs, const QString& partitionPat QStringList mountPoints; QFileInfo partitionPathFileInfo(partitionPath); + QString partitionCanonicalPath = partitionPathFileInfo.canonicalFilePath(); const QList mountedVolumes = QStorageInfo::mountedVolumes(); for (const QStorageInfo &storage : mountedVolumes) { - QFileInfo deviceFileInfo(QString::fromUtf8(storage.device())); - if (partitionPathFileInfo.canonicalFilePath() == deviceFileInfo.canonicalFilePath() ) { + if (partitionCanonicalPath == QFileInfo(QString::fromUtf8(storage.device())).canonicalFilePath() ) { mountPoints.append(storage.rootPath()); } }