View Single Post
Old 01-09-2009, 10:01 AM   #5
Hyena
New Member
 
Join Date: Nov 2008
Posts: 23
Hyena is on a distinguished road
Re: Weird crash bug at low level writing to descriptor

void sig_handler(int sig)
{
un_init_signals(); /* signal caught, don't wanna catch it again, 'cause me might loop */
switch (sig) {
case SIGTERM:
bug("Sig_handler: SIGTERM (crashed or killed)", 0);
do_auto_shutdown(TRUE);
raise(SIGTRAP);
break;
case SIGSEGV:
bug("Sig_handler: SIGSEGV (crashed)", 0);
do_auto_shutdown(TRUE);
raise(SIGTRAP);
break;
case SIGFPE:
bug("Sig_handler: SIGFPE (crashed)", 0);
do_auto_shutdown(TRUE);
raise(SIGTRAP);
break;
case SIGUSR2:
bug("Sig_handler: SIGUSR2 (external signal for auto-rebooting)", 0);
do_auto_shutdown(FALSE);
raise(SIGTRAP);
break;
default:
bug("Sig_handler: Unknown signal caught, shutting down", 0);
do_auto_shutdown(TRUE);
raise(SIGTRAP);
break;
}
}


Seems that if any signal is caught then it un_inits them am I right? As init_signal is executed only once in the very beginning of the whole program. So basically I would have to cancel un_init when there is SIGPIPE?
Hyena is offline   Reply With Quote