s3-fault: removed the cont_fn from fault_setup()
authorAndrew Tridgell <tridge@samba.org>
Tue, 22 Mar 2011 03:05:23 +0000 (14:05 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 22 Mar 2011 04:07:58 +0000 (05:07 +0100)
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 <tridge@samba.org>
Autobuild-Date: Tue Mar 22 05:07:58 CET 2011 on sn-devel-104

source3/include/proto.h
source3/lib/fault.c
source3/nmbd/nmbd.c
source3/smbd/server.c
source3/smbd/server_exit.c
source3/utils/smbcquotas.c
source3/web/swat.c
source3/winbindd/winbindd.c

index 9edbfc5902e6494e16e3c68bf900c6030e935879..c37788f97e72ed6673419eaefc2686ebd7c9896f 100644 (file)
@@ -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  */
index dd87ae110062e0c790b9028a5cd386e6d71631ce..8bb202086eda83a53f1fad0782766c3f4d07d3df 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/prctl.h>
 #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
index a5727ce14fe65590dad4a6fa5a3a22e928e48515..1735c90576e163a4b88d77c325d1217161d9a417 100644 (file)
@@ -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
index 5d2abc0bd9f8225142575dadda392458ba12068f..2c09dd26c5b2b4d06d8325557386ddbc2dd00aa8 100644 (file)
@@ -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 */
index c5cdc29380a9497431586d0d422dcc6d26190ac8..71f5094261ebbd2b2451a7f35e72fb24f0b0b2c6 100644 (file)
@@ -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");
-}
index c50ad93c253858ca9859d97590d4d56275fe0e8c..0efa60608b036d406f069cd13131f2a42915f4e3 100644 (file)
@@ -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();
index 00fbb878562cb4bb3fdee967db935efeb0358ed5..54f4cd7b2026cdbbca0d1209beb8802c37f6f258 100644 (file)
@@ -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)
index 766d8ef401c8e3ed5cbf1cd92210c57762c43242..99e98ac2b0ac39eaf05d07666572ec6e69342662 100644 (file)
@@ -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();