Fix crash in tdehwlib on partitions without parent disk

This applies for example to the software RAID defined in the BIOS

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 8 years ago
parent ff469a69ff
commit 36481f68c1

@ -2595,18 +2595,21 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
TDEDiskDeviceType::TDEDiskDeviceType disktype = sdevice->diskType(); TDEDiskDeviceType::TDEDiskDeviceType disktype = sdevice->diskType();
TDEDiskDeviceStatus::TDEDiskDeviceStatus diskstatus = TDEDiskDeviceStatus::Null; TDEDiskDeviceStatus::TDEDiskDeviceStatus diskstatus = TDEDiskDeviceStatus::Null;
if (TQString(udev_device_get_property_value(dev, "ID_PART_ENTRY_NUMBER")).isEmpty()) { TDEStorageDevice* parentdisk = NULL;
disktype = classifyDiskType(dev, devicenode, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver); if (!(TQString(udev_device_get_property_value(dev, "ID_PART_ENTRY_NUMBER")).isEmpty())) {
}
else {
// Set partition disk type and status based on the parent device
TQString parentsyspath = systempath; TQString parentsyspath = systempath;
parentsyspath.truncate(parentsyspath.length()-1); // Remove trailing slash parentsyspath.truncate(parentsyspath.length()-1); // Remove trailing slash
parentsyspath.truncate(parentsyspath.findRev("/")); parentsyspath.truncate(parentsyspath.findRev("/"));
TDEStorageDevice* parentdisk = static_cast<TDEStorageDevice*>(findBySystemPath(parentsyspath)); parentdisk = static_cast<TDEStorageDevice*>(findBySystemPath(parentsyspath));
}
if (parentdisk) {
// Set partition disk type and status based on the parent device
disktype = parentdisk->diskType(); disktype = parentdisk->diskType();
diskstatus = diskstatus | parentdisk->diskStatus(); diskstatus = diskstatus | parentdisk->diskStatus();
} }
else {
disktype = classifyDiskType(dev, devicenode, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver);
}
sdevice->internalSetDiskType(disktype); sdevice->internalSetDiskType(disktype);
device = classifyUnknownDeviceByExternalRules(dev, device, true); // Check external rules for possible subtype overrides device = classifyUnknownDeviceByExternalRules(dev, device, true); // Check external rules for possible subtype overrides
disktype = sdevice->diskType(); // The type can be overridden by an external rule disktype = sdevice->diskType(); // The type can be overridden by an external rule

Loading…
Cancel
Save