author | mickeyl <mickeyl> | 2004-11-12 13:51:35 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-11-12 13:51:35 (UTC) |
commit | de558d6f0bc31f58ffaa894a0236f0d9cb5d73e0 (patch) (unidiff) | |
tree | 55f7c2ec8c1e93983d41c962e557f3651db39b03 | |
parent | ee67d61c20b6840f3fb353e314d16a90c0438e7c (diff) | |
download | opie-de558d6f0bc31f58ffaa894a0236f0d9cb5d73e0.zip opie-de558d6f0bc31f58ffaa894a0236f0d9cb5d73e0.tar.gz opie-de558d6f0bc31f58ffaa894a0236f0d9cb5d73e0.tar.bz2 |
handle more signals and don't kill the process @ end
-rw-r--r-- | core/launcher/main.cpp | 44 |
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 | ||
239 | void handle_sigterm ( int /* sig */ ) | 239 | void 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 | ||
246 | int main( int argc, char ** argv ) | 250 | int 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 | |||
279 | int 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 | |||