diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-02-11 00:47:11 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-02-11 00:47:25 +0100 |
commit | 72efbe384ee2a5f6a15d427f573769bc42e06265 (patch) | |
tree | 93570f1ecd315e11473e0d1855a325049cd338af /tdecore/tdehw | |
parent | a5ba98c6e87b75f849967be48b4db9b8a801524b (diff) | |
download | tdelibs-72efbe384ee2a5f6a15d427f573769bc42e06265.tar.gz tdelibs-72efbe384ee2a5f6a15d427f573769bc42e06265.zip |
Fix crash in tdehwlib on partitions without parent diskr14.0.3
This applies for example to the software RAID defined in the BIOS
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 36481f68c1cbb7c55a7325d709311e20b9c2ce54)
Diffstat (limited to 'tdecore/tdehw')
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index fc8b58fa2..6d3b2edc9 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -2541,18 +2541,21 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist TDEDiskDeviceType::TDEDiskDeviceType disktype = sdevice->diskType(); TDEDiskDeviceStatus::TDEDiskDeviceStatus diskstatus = TDEDiskDeviceStatus::Null; - if (TQString(udev_device_get_property_value(dev, "ID_PART_ENTRY_NUMBER")).isEmpty()) { - disktype = classifyDiskType(dev, devicenode, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver); - } - else { - // Set partition disk type and status based on the parent device + TDEStorageDevice* parentdisk = NULL; + if (!(TQString(udev_device_get_property_value(dev, "ID_PART_ENTRY_NUMBER")).isEmpty())) { TQString parentsyspath = systempath; parentsyspath.truncate(parentsyspath.length()-1); // Remove trailing slash 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(); diskstatus = diskstatus | parentdisk->diskStatus(); } + else { + disktype = classifyDiskType(dev, devicenode, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver); + } sdevice->internalSetDiskType(disktype); device = classifyUnknownDeviceByExternalRules(dev, device, true); // Check external rules for possible subtype overrides disktype = sdevice->diskType(); // The type can be overridden by an external rule |