Browse Source

lightningd: activate crashlog before forking off as daemon.

This avoids cases like #2348 where the user gets *no* clue as to what
went wrong.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
connected_hook
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
8c22b91a70
  1. 9
      lightningd/lightningd.c

9
lightningd/lightningd.c

@ -764,6 +764,11 @@ int main(int argc, char *argv[])
* can start talking to us. */ * can start talking to us. */
plugins_config(ld->plugins); plugins_config(ld->plugins);
/*~ Setting this (global) activates the crash log: we don't usually need
* a backtrace if we fail during startup. We do this before daemonize,
* in case that runs into trouble. */
crashlog = ld->log;
/*~ We defer --daemon until we've completed most initialization: that /*~ We defer --daemon until we've completed most initialization: that
* way we'll exit with an error rather than silently exiting 0, then * way we'll exit with an error rather than silently exiting 0, then
* realizing we can't start and forcing the confused user to read the * realizing we can't start and forcing the confused user to read the
@ -808,10 +813,6 @@ int main(int argc, char *argv[])
* can start the poll loop which queries bitcoind for new blocks. */ * can start the poll loop which queries bitcoind for new blocks. */
begin_topology(ld->topology); begin_topology(ld->topology);
/*~ Setting this (global) activates the crash log: we don't usually need
* a backtrace if we fail during startup. */
crashlog = ld->log;
/*~ The root of every backtrace (almost). This is our main event /*~ The root of every backtrace (almost). This is our main event
* loop. */ * loop. */
for (;;) { for (;;) {

Loading…
Cancel
Save