From e3a580bb5da4119c943bc2cf78ee944cf33e5cb1 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 21 Aug 2011 02:46:14 +0000 Subject: [PATCH] Fix kdesudo hang when no arguments are provided git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdesudo@1248417 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesudo/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kdesudo/main.cpp b/kdesudo/main.cpp index 6ef0074..f48943d 100644 --- a/kdesudo/main.cpp +++ b/kdesudo/main.cpp @@ -37,8 +37,8 @@ static const char *description = I18N_NOOP("KdeSudo"); // INSERT A DESCRIPTION FOR YOUR APPLICATION HERE - - + + static KCmdLineOptions options[] = { { "u ", I18N_NOOP("sets a runas user"), 0 }, @@ -93,6 +93,10 @@ int main(int argc, char **argv) executable = commandlist[0]; } } + else { + kdError() << I18N_NOOP("You must provide the name of the executable you want to run as an argument to kdesudo") << endl; + exit(1); + } /* We have to make sure the executable is only the binary name */ executableList = TQStringList::split(" ", executable); @@ -102,7 +106,7 @@ int main(int argc, char **argv) int i = executableList.count() - 1; executable = executableList[i]; - /* Kubuntu has a bug in it - this is a workaround for it */ + /* Kubuntu has a bug in it - this is a workaround for it */ KGlobal::dirs()->addResourceDir("apps","/usr/share/applications/kde"); KGlobal::dirs()->addResourceDir("apps","/usr/share/applications");