soliduiserver: check if the device is removable before unmounting it

as a precaution for device invalidation after unmount

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-27 00:15:05 +03:00
parent cb97fd9984
commit 99357e8a44

View file

@ -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<Solid::StorageDrive>();
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());