summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-07-07 17:04:10 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-07-07 17:50:00 +0900
commit32566accdab31f598381e7e68330055f4a7178f1 (patch)
tree5070928d31d6bb67f231d2ddefd76758e745b474
parent09835dceb73b0e814fb7b2e915b8055d67fa83c9 (diff)
downloadtdelibs-32566accdab31f598381e7e68330055f4a7178f1.tar.gz
tdelibs-32566accdab31f598381e7e68330055f4a7178f1.zip
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>
-rw-r--r--tdecore/tdehw/tdestoragedevice.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp
index 7dd236524..5489dfc1c 100644
--- a/tdecore/tdehw/tdestoragedevice.cpp
+++ b/tdecore/tdehw/tdestoragedevice.cpp
@@ -328,6 +328,7 @@ bool ejectDriveUDisks(TDEStorageDevice* sdevice) {
if (dbusConn.isConnected()) {
TQString blockDeviceString = sdevice->deviceNode();
blockDeviceString.replace("/dev/", "");
+ blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Eject the drive!
@@ -358,6 +359,7 @@ bool ejectDriveUDisks2(TDEStorageDevice* sdevice) {
if (dbusConn.isConnected()) {
TQString blockDeviceString = sdevice->deviceNode();
blockDeviceString.replace("/dev/", "");
+ blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
TQT_DBusProxy hardwareControl("org.freedesktop.UDisks2", blockDeviceString, "org.freedesktop.DBus.Properties", dbusConn);
if (hardwareControl.canSend()) {
@@ -424,6 +426,7 @@ int mountDriveUDisks(TQString deviceNode, TQString fileSystemType, TQStringList
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
+ blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Mount the drive!
@@ -466,6 +469,7 @@ int mountDriveUDisks2(TQString deviceNode, TQString fileSystemType, TQString mou
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
+ blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
// Mount the drive!
@@ -512,6 +516,7 @@ int unMountDriveUDisks(TQString deviceNode, TQStringList unMountOptions, TQStrin
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
+ blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Mount the drive!
@@ -553,6 +558,7 @@ int unMountDriveUDisks2(TQString deviceNode, TQString unMountOptions, TQString*
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
+ blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
// Mount the drive!