Fix crash in mount/umount operations when using pmount

Remove unneeded hack in dirlister for media device root directory
pull/16/head
Timothy Pearson 11 years ago
parent 80a04dbf8a
commit a179d5d696

@ -956,8 +956,9 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOption
FILE *exepipe = popen(command.local8Bit(), "r");
if (exepipe) {
TQString mount_output;
TQTextStream ts(exepipe, IO_ReadOnly);
mount_output = ts.read();
TQTextStream* ts = new TQTextStream(exepipe, IO_ReadOnly);
mount_output = ts->read();
delete ts;
*retcode = pclose(exepipe);
if (errRet) {
*errRet = mount_output;
@ -1030,8 +1031,9 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me
FILE *exepipe = popen(command.local8Bit(), "r");
if (exepipe) {
TQString mount_output;
TQTextStream ts(exepipe, IO_ReadOnly);
mount_output = ts.read();
TQTextStream* ts = new TQTextStream(exepipe, IO_ReadOnly);
mount_output = ts->read();
delete ts;
*retcode = pclose(exepipe);
if (errRet) {
*errRet = mount_output;
@ -1132,8 +1134,9 @@ bool TDEStorageDevice::unmountDevice(TQString* errRet, int* retcode) {
FILE *exepipe = popen(command.local8Bit(), "r");
if (exepipe) {
TQString umount_output;
TQTextStream ts(exepipe, IO_ReadOnly);
umount_output = ts.read();
TQTextStream* ts = new TQTextStream(exepipe, IO_ReadOnly);
umount_output = ts->read();
delete ts;
*retcode = pclose(exepipe);
if (*retcode == 0) {
// Update internal mount data

@ -43,6 +43,8 @@
#include <kdebug.h>
#include <tqsocketnotifier.h>
extern char *__progname;
using namespace TDEIO;
Connection::Connection()
@ -187,19 +189,19 @@ bool Connection::sendnow( int _cmd, const TQByteArray &data )
size_t n = fwrite( buffer, 1, 10, f_out );
if ( n != 10 ) {
kdError(7017) << "Could not send header" << endl;
kdError(7017) << "Could not send header (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return false;
}
n = fwrite( data.data(), 1, data.size(), f_out );
if ( n != data.size() ) {
kdError(7017) << "Could not write data" << endl;
kdError(7017) << "Could not write data (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return false;
}
if (fflush( f_out )) {
kdError(7017) << "Could not write data" << endl;
kdError(7017) << "Could not write data (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return false;
}
@ -209,7 +211,7 @@ bool Connection::sendnow( int _cmd, const TQByteArray &data )
int Connection::read( int* _cmd, TQByteArray &data )
{
if (fd_in == -1 ) {
kdError(7017) << "read: not yet inited" << endl;
kdError(7017) << "read: not yet inited (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return -1;
}
@ -221,12 +223,12 @@ int Connection::read( int* _cmd, TQByteArray &data )
goto again1;
if ( n == -1) {
kdError(7017) << "Header read failed, errno=" << errno << endl;
kdError(7017) << "Header read failed, errno=" << errno << " (pid " << getpid() << " process \"" << __progname << "\")" << endl;
}
if ( n != 10 ) {
if ( n ) // 0 indicates end of file
kdError(7017) << "Header has invalid size (" << n << ")" << endl;
kdError(7017) << "Header has invalid size (" << n << ") (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return -1;
}
@ -252,11 +254,11 @@ int Connection::read( int* _cmd, TQByteArray &data )
if (errno == EINTR)
continue;
kdError(7017) << "Data read failed, errno=" << errno << endl;
kdError(7017) << "Data read failed, errno=" << errno << " (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return -1;
}
if ( !n ) { // 0 indicates end of file
kdError(7017) << "Connection ended unexpectedly (" << n << "/" << bytesToGo << ")" << endl;
kdError(7017) << "Connection ended unexpectedly (" << n << "/" << bytesToGo << ") (pid " << getpid() << " process \"" << __progname << "\")" << endl;
return -1;
}

@ -90,17 +90,6 @@ KDirListerCache::~KDirListerCache()
bool KDirListerCache::listDir( KDirLister *lister, const KURL& _u,
bool _keep, bool _reload )
{
// HACK
// The media:/ tdeioslave has massive problems related to not properly updating its root directory
// Therefore, force a reload every time the media:/ tdeioslave root is accessed!
// FIXME
// For anyone wanting to tackle this problem, it was traced into the KDirListerCache::updateDirectory TDEIO::listDir TDEIO job
// Specifically, slotUpdateResult is never called for the root directory *iff* the user descends into an unmounted media device
// Strangely, slotUpdateResult *is* called if the user instead right-clicks on the unmounted media device and selects Mount from the context menu
if ((_u.protocol() == "media") && (_u.path() == "/")) {
_reload = true;
}
// like this we don't have to worry about trailing slashes any further
KURL _url = _u;
_url.cleanPath(); // kill consecutive slashes

Loading…
Cancel
Save