From adea4c592cd28583a9a8cc24b9ec68bb118d874a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 2 Sep 2012 19:22:07 -0500 Subject: Fix pmount when special characters are requested --- tdecore/tdehardwaredevices.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'tdecore/tdehardwaredevices.cpp') diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index a16abbbac..77b847752 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -723,7 +723,9 @@ TQString TDEStorageDevice::mountPath() { TQString testNode = *mountInfo.at(0); // Check for match if ((testNode == deviceNode()) || (testNode == dmaltname)) { - return *mountInfo.at(1); + TQString ret = *mountInfo.at(1); + ret.replace("\\040", " "); + return ret; } lines += line; } @@ -762,7 +764,12 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions KTempFile passwordFile(TQString::null, "tmp", 0600); passwordFile.setAutoDelete(true); - TQString command = TQString("pmount -p %1 %2 %3 %4 2>&1").arg(passwordFile.name()).arg(mountOptions).arg(deviceNode()).arg(mediaName); + TQString passFileName = passwordFile.name(); + TQString devNode = deviceNode(); + passFileName.replace("'", "'\\''"); + devNode.replace("'", "'\\''"); + mediaName.replace("'", "'\\''"); + TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { @@ -806,7 +813,12 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me pwFile->writeBlock(passphrase.ascii(), passphrase.length()); pwFile->flush(); - TQString command = TQString("pmount -p %1 %2 %3 %4 2>&1").arg(passwordFile.name()).arg(mountOptions).arg(deviceNode()).arg(mediaName); + TQString passFileName = passwordFile.name(); + TQString devNode = deviceNode(); + passFileName.replace("'", "'\\''"); + devNode.replace("'", "'\\''"); + mediaName.replace("'", "'\\''"); + TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { @@ -839,7 +851,8 @@ bool TDEStorageDevice::unmountDevice(TQString* errRet, int* retcode) { return true; } - TQString command = TQString("pumount %1 2>&1").arg(mountpoint); + mountpoint.replace("'", "'\\''"); + TQString command = TQString("pumount '%1' 2>&1").arg(mountpoint); FILE *exepipe = popen(command.ascii(), "r"); if (exepipe) { TQString pmount_output; -- cgit v1.2.1