[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kstart
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2005-01-31 10:53:10
Message-ID: 20050131105310.B78F71D15D () office ! kde ! org
[Download RAW message or body]

CVS commit by lunakl: 

Do not run the command using shell, the args are already parsed by the shell
when running kstart.
BUG: 98160


  M +6 -21     kstart.cpp   1.65


--- kdebase/kstart/kstart.cpp  #1.64:1.65
@@ -30,17 +30,8 @@
 #include <netwm.h>
 
-pid_t execute(const QCString & cmd){
-  KProcess proc;
-  proc.setUseShell(true);
-  proc << cmd;
-  if(proc.start(KProcess::DontCare))
-      return proc.pid();
-  return -1;
-}
-
 
 // some globals
 
-static QCString command = 0;
+static KProcess proc;
 static QCString windowtitle = 0;
 static QCString windowclass = 0;
@@ -75,14 +66,9 @@ KStart::KStart()
 
     //finally execute the comand
-    pid_t pid = execute(command);
-
-    if( pid >= 0 ) {
+    if( proc.start(KProcess::DontCare) ) {
         KStartupInfoData data;
-        data.addPid( pid );
-        data.setName( command );
-        QCString bin = command;
-        int space = bin.find( ' ' ); // try to get the name of the binary
-        if( space != -1 )
-            bin = bin.left( space );
+        data.addPid( proc.pid() );
+        QCString bin = proc.args().first();
+        data.setName( bin );
         data.setBin( bin.mid( bin.findRev( '/' ) + 1 ));
         KStartupInfo::sendChange( id, data );
@@ -324,7 +310,6 @@ int main( int argc, char *argv[] )
       KCmdLineArgs::usage(i18n("No command specified"));
 
-  // Perhaps we should use a konsole-like solution here (shell, list of args...)
   for(int i=0; i < args->count(); i++)
-      command += QCString(args->arg(i)) + " ";
+    proc << args->arg(i);
 
   kwinmodule = new KWinModule;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic