Skip to content

Commit b93f6e5

Browse files
committed
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 <[email protected]>
1 parent 87a19b8 commit b93f6e5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

common/daemon.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ void send_backtrace(const char *why)
3232
if (backtrace_state)
3333
backtrace_print(backtrace_state, 0, stderr);
3434

35+
if (!bt_print)
36+
return;
37+
3538
/* Now send to parent. */
3639
bt_print("%s (version %s)", why, version());
3740
if (backtrace_state)
@@ -75,7 +78,8 @@ static void crashdump(int sig)
7578
send_backtrace(why);
7679

7780
/* Probably shouldn't return. */
78-
bt_exit();
81+
if (bt_exit)
82+
bt_exit();
7983

8084
/* This time it will kill us instantly. */
8185
kill(getpid(), sig);

0 commit comments

Comments
 (0)