From 99357e8a4400917b3b5ef9907f7a7a871f1848a3 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 27 Aug 2023 00:15:05 +0300 Subject: [PATCH] soliduiserver: check if the device is removable before unmounting it as a precaution for device invalidation after unmount Signed-off-by: Ivailo Monev --- soliduiserver/soliduiserver.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/soliduiserver/soliduiserver.cpp b/soliduiserver/soliduiserver.cpp index 0eb550d9..24ebc6c2 100644 --- a/soliduiserver/soliduiserver.cpp +++ b/soliduiserver/soliduiserver.cpp @@ -254,17 +254,17 @@ int SolidUiServer::unmountUdi(const QString &udi) return int(Solid::ErrorType::InvalidOption); } - const int unmountresult = unmountDevice(storageaccess->filePath()); - if (unmountresult != int(Solid::ErrorType::NoError)) { - return unmountresult; - } - bool isremovable = false; Solid::StorageDrive *storagedrive = device.as(); if (storagedrive) { isremovable = (storagedrive->isHotpluggable() || storagedrive->isRemovable()); } + const int unmountresult = unmountDevice(storageaccess->filePath()); + if (unmountresult != int(Solid::ErrorType::NoError)) { + return unmountresult; + } + if (storagevolume->usage() == Solid::StorageVolume::Encrypted) { QVariantMap cryptclosearguments; cryptclosearguments.insert("name", storagevolume->uuid());