From 820b52207ea8de4d8a98dd178ec1d28719b2c6ca Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 5 Aug 2019 19:13:48 +0200 Subject: [PATCH] lightningd: Defer creating the PID until we actually want to start This was causing `--help` to fail if we already had a `lightningd` running with the same `--lightning-dir`. Signed-off-by: Christian Decker --- lightningd/lightningd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index b47d2b9f7..7a4ea87ef 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -672,10 +672,6 @@ int main(int argc, char *argv[]) * say --daemonize. */ handle_early_opts(ld, argc, argv); - /*~ Now create the PID file: this errors out if there's already a - * daemon running, so we call before doing almost anything else. */ - pidfile_create(ld); - /*~ Initialize all the plugins we just registered, so they can * do their thing and tell us about themselves (including * options registration). */ @@ -684,6 +680,10 @@ int main(int argc, char *argv[]) /*~ Handle options and config; move to .lightningd (--lightning-dir) */ handle_opts(ld, argc, argv); + /*~ Now create the PID file: this errors out if there's already a + * daemon running, so we call before doing almost anything else. */ + pidfile_create(ld); + /*~ Make sure we can reach the subdaemons, and versions match. */ test_subdaemons(ld);