ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.C
(Generate patch)

Comparing deliantra/server/common/utils.C (file contents):
Revision 1.80 by root, Wed Sep 10 18:18:10 2008 UTC vs.
Revision 1.81 by root, Wed Sep 10 21:29:39 2008 UTC

449void 449void
450fork_abort (const char *msg) 450fork_abort (const char *msg)
451{ 451{
452 if (!fork ()) 452 if (!fork ())
453 { 453 {
454 fprintf (stderr, "background fork_abort in progress, remove me when debugged.\n");//D
455
454 signal (SIGINT , SIG_IGN); 456 signal (SIGINT , SIG_IGN);
455 signal (SIGTERM, SIG_IGN); 457 signal (SIGTERM, SIG_IGN);
456 signal (SIGABRT, SIG_IGN); 458 signal (SIGABRT, SIG_IGN);
459
460 signal (SIGSEGV, SIG_DFL);
461 signal (SIGBUS , SIG_DFL);
462 signal (SIGILL , SIG_DFL);
463 signal (SIGTRAP, SIG_DFL);
457 464
458 // try to put corefiles into a subdirectory, if existing, to allow 465 // try to put corefiles into a subdirectory, if existing, to allow
459 // an administrator to reduce the I/O load. 466 // an administrator to reduce the I/O load.
460 chdir ("cores"); 467 chdir ("cores");
461 468
469 476
470 for (int i = 0; i < lim.rlim_cur; ++i) 477 for (int i = 0; i < lim.rlim_cur; ++i)
471 close (i); 478 close (i);
472 } 479 }
473 480
481 {
482 sigset_t empty;
483 sigemptyset (&empty);
484 sigprocmask (SIG_SETMASK, &empty, 0);
485 }
486
487 // try to coredump with SIGTRAP
488 kill (getpid (), SIGTRAP);
474 abort (); 489 abort ();
475 } 490 }
476 491
477 LOG (llevError, "fork abort: %s\n", msg); 492 LOG (llevError, "fork abort: %s\n", msg);
478} 493}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines