Browse Source

Fix run tdesudo with empty command

This relates to Bug 1494
pull/1/head
Slávek Banko 8 years ago
parent
commit
0fd2e545b7
  1. 12
      tdesudo/main.cpp
  2. 4
      tdesudo/tdesudo.cpp

12
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);
}

4
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 <runas>] <command>\nKdeSudo will now exit..."));
noExec = true;

Loading…
Cancel
Save