diff options
Diffstat (limited to 'source3/lib/fault.c')
-rw-r--r-- | source3/lib/fault.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/source3/lib/fault.c b/source3/lib/fault.c index 20c75f7876..e132ed8f67 100644 --- a/source3/lib/fault.c +++ b/source3/lib/fault.c @@ -1,8 +1,7 @@ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. Critical Fault handling - Copyright (C) Andrew Tridgell 1992-1995 + Copyright (C) Andrew Tridgell 1992-1998 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,44 +18,39 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef LINUX -#define __KERNEL__ -#endif - #include "includes.h" -extern int DEBUGLEVEL; - - -static void (*cont_fn)(); +static void (*cont_fn)(void *); /******************************************************************* report a fault ********************************************************************/ static void fault_report(int sig) { - DEBUG(0,("===============================================================\n")); - DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)getpid(),VERSION)); - DEBUG(0,("\nPlease read the file BUGS.txt in the distribution\n")); - DEBUG(0,("===============================================================\n")); + static int counter; + + if (counter) _exit(1); + + counter++; + + DEBUG(0,("===============================================================\n")); + DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),VERSION)); + DEBUG(0,("\nPlease read the file BUGS.txt in the distribution\n")); + DEBUG(0,("===============================================================\n")); -#if AJT - ajt_panic(); -#endif + smb_panic("internal error"); - if (cont_fn) - { - fault_setup(cont_fn); - cont_fn(NULL); + if (cont_fn) { + cont_fn(NULL); #ifdef SIGSEGV - signal(SIGSEGV,SIGNAL_CAST SIG_DFL); + CatchSignal(SIGSEGV,SIGNAL_CAST SIG_DFL); #endif #ifdef SIGBUS - signal(SIGBUS,SIGNAL_CAST SIG_DFL); + CatchSignal(SIGBUS,SIGNAL_CAST SIG_DFL); #endif - return; /* this should cause a core dump */ - } - exit(1); + return; /* this should cause a core dump */ + } + exit(1); } /**************************************************************************** @@ -64,21 +58,21 @@ catch serious errors ****************************************************************************/ static void sig_fault(int sig) { - fault_report(sig); + fault_report(sig); } /******************************************************************* setup our fault handlers ********************************************************************/ -void fault_setup(void (*fn)()) +void fault_setup(void (*fn)(void *)) { - cont_fn = fn; + cont_fn = fn; #ifdef SIGSEGV - signal(SIGSEGV,SIGNAL_CAST sig_fault); + CatchSignal(SIGSEGV,SIGNAL_CAST sig_fault); #endif #ifdef SIGBUS - signal(SIGBUS,SIGNAL_CAST sig_fault); + CatchSignal(SIGBUS,SIGNAL_CAST sig_fault); #endif } |