File kdesu-symbol-lookup-workaround.diff of Package kdebase4-runtime

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.sav	2010-03-16 10:33:25.000000000 +0100
+++ kdesu/kdesu/kdesu.cpp	2010-05-28 16:41:00.000000000 +0200
@@ -72,6 +72,8 @@
 
 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
@@ -138,7 +140,7 @@
 
     int result = startApp();
 
-    if (result == 127)
+    if (result == 127 && !commandWasOk)
     {
         KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
     }
@@ -256,6 +258,8 @@
         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)