From c8297073dbaf19237891fd97d9e62dc00ad4e1f0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 22 Mar 2011 14:05:23 +1100 Subject: s3-fault: removed the cont_fn from fault_setup() cont_fn() was supposed to be a way to continue after a seg fault. It could never be called however, as smb_panic() from fault_report() could never return, as dump_core() never returns at the end of smb_panic() Autobuild-User: Andrew Tridgell Autobuild-Date: Tue Mar 22 05:07:58 CET 2011 on sn-devel-104 --- source3/include/proto.h | 2 +- source3/lib/fault.c | 19 ++----------------- source3/nmbd/nmbd.c | 11 +---------- source3/smbd/server.c | 2 +- source3/smbd/server_exit.c | 5 ----- source3/utils/smbcquotas.c | 2 +- source3/web/swat.c | 2 +- source3/winbindd/winbindd.c | 11 +---------- 8 files changed, 8 insertions(+), 46 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 9edbfc5902..c37788f97e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -516,7 +516,7 @@ NTSTATUS map_nt_error_from_unix(int unix_error); int map_errno_from_nt_status(NTSTATUS status); /* The following definitions come from lib/fault.c */ -void fault_setup(void (*fn)(void *)); +void fault_setup(void); void dump_core_setup(const char *progname); /* The following definitions come from lib/file_id.c */ diff --git a/source3/lib/fault.c b/source3/lib/fault.c index dd87ae1100..8bb202086e 100644 --- a/source3/lib/fault.c +++ b/source3/lib/fault.c @@ -29,7 +29,6 @@ #include #endif -static void (*cont_fn)(void *); static char *corepath; /******************************************************************* @@ -51,19 +50,7 @@ static void fault_report(int sig) smb_panic("internal error"); - if (cont_fn) { - cont_fn(NULL); -#ifdef SIGSEGV - CatchSignal(SIGSEGV, SIG_DFL); -#endif -#ifdef SIGBUS - CatchSignal(SIGBUS, SIG_DFL); -#endif -#ifdef SIGABRT - CatchSignal(SIGABRT, SIG_DFL); -#endif - return; /* this should cause a core dump */ - } + /* smb_panic() never returns, so this is really redundent */ exit(1); } @@ -78,10 +65,8 @@ static void sig_fault(int sig) /******************************************************************* setup our fault handlers ********************************************************************/ -void fault_setup(void (*fn)(void *)) +void fault_setup(void) { - cont_fn = fn; - #ifdef SIGSEGV CatchSignal(SIGSEGV, sig_fault); #endif diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index a5727ce14f..1735c90576 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -160,15 +160,6 @@ static void nmbd_terminate(struct messaging_context *msg, terminate(); } -/**************************************************************************** ** - Possibly continue after a fault. - **************************************************************************** */ - -static void fault_continue(void) -{ - dump_core(); -} - /**************************************************************************** ** Expire old names from the namelist and server list. **************************************************************************** */ @@ -820,7 +811,7 @@ static bool open_sockets(bool isdaemon, int port) SAFE_FREE(lfile); } - fault_setup((void (*)(void *))fault_continue ); + fault_setup(); dump_core_setup("nmbd"); /* POSIX demands that signals are inherited. If the invoking process has diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 5d2abc0bd9..2c09dd26c5 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -986,7 +986,7 @@ extern void build_options(bool screen); gain_root_privilege(); gain_root_group_privilege(); - fault_setup((void (*)(void *))exit_server_fault); + fault_setup(); dump_core_setup("smbd"); /* we are never interested in SIGPIPE */ diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c index c5cdc29380..71f5094261 100644 --- a/source3/smbd/server_exit.c +++ b/source3/smbd/server_exit.c @@ -204,8 +204,3 @@ void exit_server_cleanly(const char *const explanation) { exit_server_common(SERVER_EXIT_NORMAL, explanation); } - -void exit_server_fault(void) -{ - exit_server("critical server fault"); -} diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index c50ad93c25..0efa60608b 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -598,7 +598,7 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" }, setlinebuf(stdout); - fault_setup(NULL); + fault_setup(); lp_load(get_dyn_CONFIGFILE(),True,False,False,True); load_interfaces(); diff --git a/source3/web/swat.c b/source3/web/swat.c index 00fbb87856..54f4cd7b20 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -1403,7 +1403,7 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid) }; TALLOC_CTX *frame = talloc_stackframe(); - fault_setup(NULL); + fault_setup(); umask(S_IWGRP | S_IWOTH); #if defined(HAVE_SET_AUTH_PARAMETERS) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 766d8ef401..99e98ac2b0 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -86,15 +86,6 @@ static bool reload_services_file(const char *lfile) } -/**************************************************************************** ** - Handle a fault.. - **************************************************************************** */ - -static void fault_quit(void) -{ - dump_core(); -} - static void winbindd_status(void) { struct winbindd_cli_state *tmp; @@ -1238,7 +1229,7 @@ int main(int argc, char **argv, char **envp) CatchSignal(SIGUSR1, SIG_IGN); CatchSignal(SIGUSR2, SIG_IGN); - fault_setup((void (*)(void *))fault_quit ); + fault_setup(); dump_core_setup("winbindd"); load_case_tables(); -- cgit