LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kdesu-symbol-lookup-workaround.diff of Package kdebase4-runtime (Project home:alarrosa:branches:SLE12SP2:KDE:Applications)

Subject: Avoid error dialog caused by symbol lookup error
From: Lubos Lunak
Bug: bnc#444800
Patch-upstream: no

For whatever reason launching kdm control module leads to a symbol lookup error
during its exit, which leads to its exit code being 127, i.e. not found.
Add ugly hack to hide this case.

---
 kdesu/kdesu/kdesu.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kdesu/kdesu/kdesu.cpp b/kdesu/kdesu/kdesu.cpp
index 3640545..2c181df 100644
--- a/kdesu/kdesu/kdesu.cpp
+++ b/kdesu/kdesu/kdesu.cpp
@@ -71,6 +71,8 @@ QByteArray dcopNetworkId()
 
 static int startApp();
 
+static bool commandWasOk = false;
+
 int main(int argc, char *argv[])
 {
     // FIXME: this can be considered a poor man's solution, as it's not
@@ -137,7 +139,7 @@ int main(int argc, char *argv[])
 
     int result = startApp();
 
-    if (result == 127)
+    if (result == 127 && !commandWasOk)
     {
         KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
     }
@@ -255,6 +257,8 @@ static int startApp()
         command += ' ';
         command += QFile::encodeName(KShell::quoteArg(args->arg(i)));
     }
+    QStringList commandItems = QString::fromLocal8Bit( command ).split( ' ' );
+    commandWasOk = ( !commandItems.isEmpty() && !KStandardDirs::findExe( commandItems.first()).isEmpty());
 
     // Don't change uid if we're don't need to.
     if (!change_uid)
-- 
1.8.4.4