summaryrefslogtreecommitdiff
path: root/core/launcher/main.cpp
Unidiff
Diffstat (limited to 'core/launcher/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/main.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index b119399..aa0dfdf 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -238,19 +238,23 @@ void remove_pidfile ( )
238 238
239void handle_sigterm ( int /* sig */ ) 239void handle_sigterm ( int /* sig */ )
240{ 240{
241 if ( qApp ) 241 ::signal( SIGCHLD, SIG_IGN );
242 qApp-> quit ( ); 242 ::signal( SIGSEGV, SIG_IGN );
243 ::signal( SIGBUS, SIG_IGN );
244 ::signal( SIGILL, SIG_IGN );
245 ::signal( SIGTERM, SIG_IGN );
246 ::signal ( SIGINT, SIG_IGN );
247 if ( qApp ) qApp->quit();
243} 248}
244 249
245#ifndef Q_OS_WIN32
246int main( int argc, char ** argv ) 250int main( int argc, char ** argv )
247{ 251{
248
249 ::signal ( SIGCHLD, SIG_IGN ); 252 ::signal ( SIGCHLD, SIG_IGN );
250 253 ::signal( SIGSEGV, handle_sigterm );
254 ::signal( SIGBUS, handle_sigterm );
255 ::signal( SIGILL, handle_sigterm );
251 ::signal ( SIGTERM, handle_sigterm ); 256 ::signal ( SIGTERM, handle_sigterm );
252 ::signal ( SIGINT, handle_sigterm ); 257 ::signal ( SIGINT, handle_sigterm );
253
254 ::setsid ( ); 258 ::setsid ( );
255 ::setpgid ( 0, 0 ); 259 ::setpgid ( 0, 0 );
256 260
@@ -260,33 +264,11 @@ int main( int argc, char ** argv )
260 int retVal = initApplication( argc, argv ); 264 int retVal = initApplication( argc, argv );
261 265
262 // Have we been asked to restart? 266 // Have we been asked to restart?
263 if ( ServerApplication::doRestart ) { 267 if ( ServerApplication::doRestart )
264 for ( int fd = 3; fd < 100; fd++ )
265 close( fd );
266
267 execl( (QPEApplication::qpeDir()+"bin/qpe").latin1(), "qpe", 0 );
268 }
269
270 // Kill them. Kill them all.
271 ::kill ( 0, SIGTERM );
272 ::sleep ( 1 );
273 ::kill ( 0, SIGKILL );
274
275 return retVal;
276}
277#else
278
279int main( int argc, char ** argv )
280{ 268{
281 int retVal = initApplication( argc, argv ); 269 for ( int fd = 3; fd < 100; fd++ ) close( fd );
282 270 execl( (QPEApplication::qpeDir()+"bin/qpe").latin1(), "qpe", 0 );
283 if ( DesktopApplication::doRestart ) {
284 odebug << "Trying to restart" << oendl;
285 execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 );
286 } 271 }
287 272
288 return retVal; 273 return retVal;
289} 274}
290
291#endif
292