mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
common: don't crash on send_backtrace() if bt_print is NULL.
This (and bt_exit) are NULL for libplugin. We don't always want to crash! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
fd7ac4e05b
commit
89ca5aef9f
1 changed files with 5 additions and 1 deletions
|
@ -32,6 +32,9 @@ void send_backtrace(const char *why)
|
|||
if (backtrace_state)
|
||||
backtrace_print(backtrace_state, 0, stderr);
|
||||
|
||||
if (!bt_print)
|
||||
return;
|
||||
|
||||
/* Now send to parent. */
|
||||
bt_print("%s (version %s)", why, version());
|
||||
if (backtrace_state)
|
||||
|
@ -75,7 +78,8 @@ static void crashdump(int sig)
|
|||
send_backtrace(why);
|
||||
|
||||
/* Probably shouldn't return. */
|
||||
bt_exit();
|
||||
if (bt_exit)
|
||||
bt_exit();
|
||||
|
||||
/* This time it will kill us instantly. */
|
||||
kill(getpid(), sig);
|
||||
|
|
Loading…
Add table
Reference in a new issue