diff --git a/tdesudo/main.cpp b/tdesudo/main.cpp index 33a09d8..c9b7538 100644 --- a/tdesudo/main.cpp +++ b/tdesudo/main.cpp @@ -84,20 +84,18 @@ int main(int argc, char **argv) bool withIgnoreButton = args->isSet("ignorebutton"); - if (args->isSet("c")) + if (args->isSet("c")) { executable = args->getOption("c"); - - if (args->count()) - { - if (executable.isEmpty()) - { + } + else { + if (args->count()) { command = args->arg(0); commandlist = TQStringList::split(TQChar(' '), command); executable = commandlist[0]; } } - if ((!args->isSet("c")) && (!args->count())) { + if (executable.stripWhiteSpace().isEmpty()) { kdError() << I18N_NOOP("You must provide the name of the executable you want to run as an argument to tdesudo") << endl; exit(1); } diff --git a/tdesudo/tdesudo.cpp b/tdesudo/tdesudo.cpp index c5509d9..97a74e9 100644 --- a/tdesudo/tdesudo.cpp +++ b/tdesudo/tdesudo.cpp @@ -68,7 +68,9 @@ KdeSudo::KdeSudo(TQWidget *parent, const char *name,const TQString& icon, const TQString runas = args->getOption("u"); TQString cmd; - if (!args->isSet("c") && !args->count() && (!args->isSet("s"))) + if (!(args->isSet("c") && !args->getOption("c").stripWhiteSpace().isEmpty()) && + !(!args->isSet("c") && args->count()) && + !args->isSet("s")) { KMessageBox::information(NULL, i18n("No command arguments supplied!\nUsage: tdesudo [-u ] \nKdeSudo will now exit...")); noExec = true;