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 23:13:18 +0900
commitc90f6c3e505d2afaf08051fafe941a783df752a2 (patch)
treec63cecd23eb8f9c4e2d8486318008280ce5ee96d
parent0f7cda9d52c90a780716915547f479eaa43b909a (diff)
downloadtdelibs-c90f6c3e505d2afaf08051fafe941a783df752a2.tar.gz
tdelibs-c90f6c3e505d2afaf08051fafe941a783df752a2.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> (cherry picked from commit 32566accdab31f598381e7e68330055f4a7178f1)
-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 b8b5c6d33..1530d6238 100644
--- a/tdecore/tdehw/tdestoragedevice.cpp
+++ b/tdecore/tdehw/tdestoragedevice.cpp
@@ -112,6 +112,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!
@@ -142,6 +143,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()) {
@@ -208,6 +210,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!
@@ -250,6 +253,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!
@@ -296,6 +300,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!
@@ -337,6 +342,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!