Updated handling of removed status for devices without image file support

This commit is contained in:
Uwe Seimet 2021-09-05 16:58:02 +02:00
parent 695a9967b8
commit db6a5a0970

View File

@ -732,9 +732,13 @@ bool Attach(int fd, const PbDeviceDefinition& pb_device, Device *map[], bool dry
}
}
// If no filename was provided the media is considered removed
if (filename.empty()) {
device->SetRemoved(true);
// If no filename was provided the medium is considered removed
FileSupport *file_support = dynamic_cast<FileSupport *>(device);
if (file_support) {
device->SetRemoved(filename.empty());
}
else {
device->SetRemoved(false);
}
device->SetId(id);
@ -771,8 +775,6 @@ bool Attach(int fd, const PbDeviceDefinition& pb_device, Device *map[], bool dry
}
}
FileSupport *file_support = dynamic_cast<FileSupport *>(device);
// File check (type is HD, for removable media drives, CD and MO the medium (=file) may be inserted later)
if (file_support && !device->IsRemovable() && filename.empty()) {
delete device;