summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-12-11 01:40:57 +0100
committerSlávek Banko <slavek.banko@axis.cz>2013-12-11 01:43:06 +0100
commitef6c5d6fcbafccf6fa2a5b6b46d94ed627903a2f (patch)
treee4a0449ed71a966ab5a3f4a497ec544b0b78b22f /tdecore/tdehw
parent1060593d12a527b48e329a1d18448978d525e79d (diff)
downloadtdelibs-ef6c5d6fcbafccf6fa2a5b6b46d94ed627903a2f.tar.gz
tdelibs-ef6c5d6fcbafccf6fa2a5b6b46d94ed627903a2f.zip
Fix mount media without known filesystem in tdehw storage backend
This resolves Bug 1753
Diffstat (limited to 'tdecore/tdehw')
-rw-r--r--tdecore/tdehw/tdestoragedevice.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp
index 2dd812a79..0973dabea 100644
--- a/tdecore/tdehw/tdestoragedevice.cpp
+++ b/tdecore/tdehw/tdestoragedevice.cpp
@@ -226,9 +226,9 @@ bool TDEStorageDevice::ejectDrive() {
FILE *exepipe = popen(command.ascii(), "r");
if (exepipe) {
- TQString pmount_output;
- char buffer[8092];
- pmount_output = fgets(buffer, sizeof(buffer), exepipe);
+ TQString eject_output;
+ TQTextStream ts(exepipe, IO_ReadOnly);
+ eject_output = ts.read();
int retcode = pclose(exepipe);
if (retcode == 0) {
return TRUE;
@@ -661,7 +661,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOption
optionString.insert(0, "-o ");
}
- if (mountOptions.contains("filesystem")) {
+ if (mountOptions.contains("filesystem") && !mountOptions["filesystem"].isEmpty()) {
optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
}
@@ -681,7 +681,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOption
optionString.insert(0, "--mount-options ");
}
- if (mountOptions.contains("filesystem")) {
+ if (mountOptions.contains("filesystem") && !mountOptions["filesystem"].isEmpty()) {
optionString.append(TQString(" --mount-fstype %1").arg(mountOptions["filesystem"]));
}
@@ -715,7 +715,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOption
optionString.append(" -s");
}
- if (mountOptions.contains("filesystem")) {
+ if (mountOptions.contains("filesystem") && !mountOptions["filesystem"].isEmpty()) {
optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
}
@@ -736,12 +736,12 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOption
FILE *exepipe = popen(command.local8Bit(), "r");
if (exepipe) {
- TQString pmount_output;
- char buffer[8092];
- pmount_output = fgets(buffer, sizeof(buffer), exepipe);
+ TQString mount_output;
+ TQTextStream ts(exepipe, IO_ReadOnly);
+ mount_output = ts.read();
*retcode = pclose(exepipe);
if (errRet) {
- *errRet = pmount_output;
+ *errRet = mount_output;
}
}
@@ -793,7 +793,7 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me
optionString.append(" -s");
}
- if (mountOptions.contains("filesystem")) {
+ if (mountOptions.contains("filesystem") && !mountOptions["filesystem"].isEmpty()) {
optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
}
@@ -810,12 +810,12 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me
FILE *exepipe = popen(command.local8Bit(), "r");
if (exepipe) {
- TQString pmount_output;
- char buffer[8092];
- pmount_output = fgets(buffer, sizeof(buffer), exepipe);
+ TQString mount_output;
+ TQTextStream ts(exepipe, IO_ReadOnly);
+ mount_output = ts.read();
*retcode = pclose(exepipe);
if (errRet) {
- *errRet = pmount_output;
+ *errRet = mount_output;
}
}
@@ -867,16 +867,16 @@ bool TDEStorageDevice::unmountDevice(TQString* errRet, int* retcode) {
FILE *exepipe = popen(command.local8Bit(), "r");
if (exepipe) {
- TQString pmount_output;
- char buffer[8092];
- pmount_output = fgets(buffer, sizeof(buffer), exepipe);
+ TQString umount_output;
+ TQTextStream ts(exepipe, IO_ReadOnly);
+ umount_output = ts.read();
*retcode = pclose(exepipe);
if (*retcode == 0) {
return true;
}
else {
if (errRet) {
- *errRet = pmount_output;
+ *errRet = umount_output;
}
}
}