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

List:       kde-commits
Subject:    KONQE_1_0_BRANCH: kdenox/konq-embed/src [POSSIBLY UNSAFE]
From:       Paul Chitescu <pchitescu () pchitescu ! myip ! org>
Date:       2003-02-28 15:23:50
[Download RAW message or body]

CVS commit by pchitescu: 

Added --pidfile command line option - comes in handy to send signals.


  M +18 -1     main.cc   1.35.2.28 [POSSIBLY UNSAFE: printf]


--- kdenox/konq-embed/src/main.cc  #1.35.2.27:1.35.2.28
@@ -56,4 +56,5 @@
 
 #if !defined(Q_WS_WIN)
+#include <qfile.h>
 #include <signal.h>
 
@@ -70,5 +71,5 @@ void setupSignalHandler()
 }
 
-#endif
+#endif // !Q_WS_WIN
 
 #include "mainwindowbase.h"
@@ -215,4 +216,20 @@ int main( int argc, char **argv )
         else if ( arg == "--warn-close" )
             MainWindowBase::s_warnClose=TRUE;
+#if !defined(Q_WS_WIN)
+        else if ( arg.startsWith( "--pidfile:" ) )
+        {
+            if ( arg.length() > 10 )
+            {
+                QFile f( arg.mid( 10 ) );
+                if ( f.open( IO_WriteOnly | IO_Truncate ) )
+                {
+                    char pid[24]; // it is enough even for 64-bit machines
+                    sprintf( pid, "%ld\n", (long)::getpid() );
+                    f.writeBlock( pid, qstrlen( pid ) );
+                    f.close();
+                }
+            }
+        }
+#endif
     }
 #endif // PARSE_CMDLINE


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

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