Fix run tdesu with empty command

This relates to Bug 1494
pull/2/head
Slávek Banko 11 years ago
parent 7bf342b15f
commit 21cc8cea31

@ -218,33 +218,24 @@ static int startApp()
} }
// Get command // Get command
if (args->isSet("c")) if (args->isSet("c")) {
{
command = args->getOption("c"); command = args->getOption("c");
for (int i=0; i<args->count(); i++) }
{ else {
TQString arg = TQFile::decodeName(args->arg(i)); if( args->count() ) {
KRun::shellQuote(arg); command = args->arg(0);
command += " ";
command += TQFile::encodeName(arg);
} }
} }
else if (command.stripWhiteSpace().isEmpty()) {
{
if( args->count() == 0 )
{
TDECmdLineArgs::usage(i18n("No command specified.")); TDECmdLineArgs::usage(i18n("No command specified."));
exit(1); exit(1);
} }
command = args->arg(0); for (int i= args->isSet("c") ? 0 : 1; i<args->count(); i++) {
for (int i=1; i<args->count(); i++)
{
TQString arg = TQFile::decodeName(args->arg(i)); TQString arg = TQFile::decodeName(args->arg(i));
KRun::shellQuote(arg); KRun::shellQuote(arg);
command += " "; command += " ";
command += TQFile::encodeName(arg); command += TQFile::encodeName(arg);
} }
}
// Don't change uid if we're don't need to. // Don't change uid if we're don't need to.
if (!change_uid) if (!change_uid)

Loading…
Cancel
Save