From: Andrew Bartlett Date: Tue, 25 Feb 2020 22:58:48 +0000 (+1300) Subject: Move INTERNAL ERROR... printout into smb_panic() and improve "why" string X-Git-Tag: ldb-2.2.0~1568 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ee326f31d1a26e0cbe691c2948b06cefa29caf2;p=thirdparty%2Fsamba.git Move INTERNAL ERROR... printout into smb_panic() and improve "why" string The "why" string is now eg "Signal 11: Segmentation fault" and so more descriptive, and hopefully this will encourage the Samba version to be included in more error reports. Signed-off-by: Andrew Bartlett Reviewed-by: Gary Lockyer --- diff --git a/lib/util/fault.c b/lib/util/fault.c index c42bc51789a..a34f9eedb31 100644 --- a/lib/util/fault.c +++ b/lib/util/fault.c @@ -71,21 +71,15 @@ report a fault static void fault_report(int sig) { static int counter; + char signal_string[128]; if (counter) _exit(1); counter++; - DEBUGSEP(0); - DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)getpid(),SAMBA_VERSION_STRING)); - DEBUG(0,("\nIf you are running a recent Samba version, and " - "if you think this problem is not yet fixed in the " - "latest versions, please consider reporting this " - "bug, see " - "https://wiki.samba.org/index.php/Bug_Reporting\n")); - DEBUGSEP(0); - - smb_panic("internal error"); + snprintf(signal_string, sizeof(signal_string), + "Signal %d: %s", sig, strsignal(sig)); + smb_panic(signal_string); /* smb_panic() never returns, so this is really redundant */ exit(1); @@ -170,6 +164,15 @@ static void smb_panic_default(const char *why) **/ _PUBLIC_ void smb_panic(const char *why) { + DEBUGSEP(0); + DEBUG(0,("INTERNAL ERROR: %s in pid %d (%s)",why,(int)getpid(),SAMBA_VERSION_STRING)); + DEBUG(0,("\nIf you are running a recent Samba version, and " + "if you think this problem is not yet fixed in the " + "latest versions, please consider reporting this " + "bug, see " + "https://wiki.samba.org/index.php/Bug_Reporting\n")); + DEBUGSEP(0); + if (fault_state.panic_handler) { fault_state.panic_handler(why); _exit(1);