[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 225868] Amarok detect my ipod even if not mounted and think it's
From: Martin Aumueller <aumuell () reserv ! at>
Date: 2010-02-10 0:57:39
Message-ID: 20100210005739.4D3B7327AD () immanuel ! kde ! org
[Download RAW message or body]
https://bugs.kde.org/show_bug.cgi?id=225868
--- Comment #14 from Martin Aumueller <aumuell reserv at> 2010-02-10 01:57:28 ---
commit 23c047726df82db1b78faa95d85cabd4410b6c19
Author: Martin Aumà ¼ller <aumuell@reserv.at>
Date: Mon Feb 8 03:24:43 2010 +0100
better error handling during ifuse/fusermount calls
CCBUG: 225868
diff --git a/src/collection/ipodcollection/handler/IpodHandler.cpp
b/src/collection/ipodcollection/handler/IpodHandler.cpp
index 01d72f4..ffb4d84 100644
--- a/src/collection/ipodcollection/handler/IpodHandler.cpp
+++ b/src/collection/ipodcollection/handler/IpodHandler.cpp
@@ -118,17 +118,43 @@ IpodHandler::~IpodHandler()
if ( m_itdb )
itdb_free( m_itdb );
- if( !m_deviceInfo->wasMounted() && !m_deviceInfo->mountPoint().isEmpty())
+ if( m_autoConnect )
{
- int result = QProcess::execute("fusermount -u " + mountPoint());
- if( result )
+ QProcess unmount;
+ QStringList args;
+ args << "-u" << mountPoint();
+ unmount.start("fusermount", args);
+ bool ok = unmount.waitForStarted();
+ if( !ok )
{
- debug() << "Unmounting imobiledevice using ifuse from" <<
mountPoint() << "failed";
+ debug() << "fusermount for unmounting" << mountPoint() << "failed
to start";
}
else
{
+ ok = unmount.waitForFinished();
+ if( !ok )
+ debug() << "fusermount did not terminate correctly";
+ }
+ if( ok )
+ {
+ ok = unmount.exitStatus() == QProcess::NormalExit;
+ if( !ok )
+ debug() << "fusermount did not exit normally";
+ }
+ if( ok )
+ {
+ ok = unmount.exitCode() == 0;
+ if( !ok )
+ debug() << "fusermount did not exit successfully";
+ }
+ if( ok )
+ {
debug() << "Unmounted imobiledevice using ifuse from" <<
mountPoint();
}
+ else
+ {
+ debug() << "Unmounting imobiledevice using ifuse from" <<
mountPoint() << "failed";
+ }
}
}
@@ -138,23 +164,47 @@ IpodHandler::init()
bool isMounted = m_deviceInfo->wasMounted();
if ( !isMounted )
{
- int result = -1;
- if( m_deviceInfo->deviceUid().isEmpty() )
+ QStringList args;
+ if( !m_deviceInfo->deviceUid().isEmpty() )
+ {
+ args << "--uuid";
+ args << m_deviceInfo->deviceUid();
+ }
+ args << mountPoint();
+ QProcess ifuse;
+ ifuse.start("ifuse", args);
+ bool ok = ifuse.waitForStarted();
+ if( !ok )
{
- result = QProcess::execute(QString("ifuse " + mountPoint()));
+ debug() << "Failed to start ifuse";
}
else
{
- result = QProcess::execute(QString("ifuse --uuid" +
m_deviceInfo->deviceUid() + " " + mountPoint()));
+ ok = ifuse.waitForFinished();
+ if( !ok )
+ debug() << "ifuse did not yet terminate";
}
- if (result)
+ if( ok )
{
- debug() << "Mounting imobiledevice using ifuse on" << mountPoint()
<< "failed";
+ ok = ifuse.exitStatus() == QProcess::NormalExit;
+ if( !ok )
+ debug() << "ifuse crashed";
}
- else
+ if( ok )
+ {
+ ok = ifuse.exitCode() == 0;
+ if( !ok )
+ debug() << "ifuse exited with non-zero exit code";
+ }
+
+ if( ok )
{
- debug() << "Successfully mounted imobiledevice using ifuse on" <<
mountPoint();
isMounted = true;
+ debug() << "Successfully mounted imobiledevice using ifuse on" <<
mountPoint();
+ }
+ else
+ {
+ debug() << "Mounting imobiledevice using ifuse on" << mountPoint()
<< "failed";
}
}
@@ -165,6 +215,8 @@ IpodHandler::init()
return;
}
+ m_autoConnect = !m_deviceInfo->wasMounted();
+
GError *err = 0;
QString initError = i18n( "iPod was not initialized:" );
QString initErrorCaption = i18n( "iPod Initialization Failed" );
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic