From c987402691f08e038139911a5b4ed4aef7d1ca73 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Sat, 4 Feb 2012 10:14:13 +0000 Subject: [PATCH] Workaround broken kdesu backward compatibility. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1278089 --- src/util/helpers.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/util/helpers.cpp b/src/util/helpers.cpp index cb61cdb..ddffb84 100644 --- a/src/util/helpers.cpp +++ b/src/util/helpers.cpp @@ -84,10 +84,22 @@ bool checkPermissions() // endless loops of calling the same non-working (kde|gk)su(do) binary again and again. if (!suCommand().isEmpty() && !args->isSet("dontsu")) { - if (QProcess::execute(suCommand(), QStringList() << args->allArguments().join(" ") + " --dontsu") == 0) + QStringList argList; + + const QString suCmd = suCommand(); + + // kdesu broke backward compatibility at some point and now only works with "-c"; + // kdesudo accepts either (with or without "-c"), but the gk* helpers only work + // without. kdesu maintainers won't fix their app, so we need to work around that here. + if (suCmd.startsWith("kde")) + argList << "-c"; + + argList << args->allArguments().join(" ") + " --dontsu"; + + if (QProcess::execute(suCmd, argList) == 0) return false; } - + return KMessageBox::warningContinueCancel(NULL, i18nc("@info", "You do not have administrative privileges." "It is possible to run %1 without these privileges. "