tdehw: avoid crashing kded when using udisks/udisks2 to operate on

drives that contain dashes. This relates to issue #32.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/36/head
Michele Calgaro 5 years ago
parent 09835dceb7
commit 32566accda

@ -328,6 +328,7 @@ bool ejectDriveUDisks(TDEStorageDevice* sdevice) {
if (dbusConn.isConnected()) { if (dbusConn.isConnected()) {
TQString blockDeviceString = sdevice->deviceNode(); TQString blockDeviceString = sdevice->deviceNode();
blockDeviceString.replace("/dev/", ""); blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString; blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Eject the drive! // Eject the drive!
@ -358,6 +359,7 @@ bool ejectDriveUDisks2(TDEStorageDevice* sdevice) {
if (dbusConn.isConnected()) { if (dbusConn.isConnected()) {
TQString blockDeviceString = sdevice->deviceNode(); TQString blockDeviceString = sdevice->deviceNode();
blockDeviceString.replace("/dev/", ""); blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString; blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
TQT_DBusProxy hardwareControl("org.freedesktop.UDisks2", blockDeviceString, "org.freedesktop.DBus.Properties", dbusConn); TQT_DBusProxy hardwareControl("org.freedesktop.UDisks2", blockDeviceString, "org.freedesktop.DBus.Properties", dbusConn);
if (hardwareControl.canSend()) { if (hardwareControl.canSend()) {
@ -424,6 +426,7 @@ int mountDriveUDisks(TQString deviceNode, TQString fileSystemType, TQStringList
if (dbusConn.isConnected()) { if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode; TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", ""); blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString; blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Mount the drive! // Mount the drive!
@ -466,6 +469,7 @@ int mountDriveUDisks2(TQString deviceNode, TQString fileSystemType, TQString mou
if (dbusConn.isConnected()) { if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode; TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", ""); blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString; blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
// Mount the drive! // Mount the drive!
@ -512,6 +516,7 @@ int unMountDriveUDisks(TQString deviceNode, TQStringList unMountOptions, TQStrin
if (dbusConn.isConnected()) { if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode; TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", ""); blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString; blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Mount the drive! // Mount the drive!
@ -553,6 +558,7 @@ int unMountDriveUDisks2(TQString deviceNode, TQString unMountOptions, TQString*
if (dbusConn.isConnected()) { if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode; TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", ""); blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString; blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
// Mount the drive! // Mount the drive!

Loading…
Cancel
Save