summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2013-09-27 02:00:42 +0200
committerSlávek Banko <[email protected]>2013-09-27 02:00:42 +0200
commit0fd2e545b7a65043d7c2296a60ff6e6a05775275 (patch)
treea276b5a601deb6b7e38c10404e757f2cc2a7fc26
parentfc829172ee83b4acdb18052f0d267b92fb1292ad (diff)
downloadtdesudo-0fd2e545b7a65043d7c2296a60ff6e6a05775275.tar.gz
tdesudo-0fd2e545b7a65043d7c2296a60ff6e6a05775275.zip
Fix run tdesudo with empty command
This relates to Bug 1494
-rw-r--r--tdesudo/main.cpp12
-rw-r--r--tdesudo/tdesudo.cpp4
2 files changed, 8 insertions, 8 deletions
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 <runas>] <command>\nKdeSudo will now exit..."));
noExec = true;