From c66df316742052b8b0570044b562dd0948d2f372 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 15 Jan 2018 20:08:00 +1030 Subject: [PATCH] subd: pass absolute path as argv[0]. This means we print out the correct path with --debugger, which can be vital if there are multiple binaries (eg. compiled vs installed). Signed-off-by: Rusty Russell --- lightningd/subd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lightningd/subd.c b/lightningd/subd.c index 8efbbcabc..e49c310b3 100644 --- a/lightningd/subd.c +++ b/lightningd/subd.c @@ -154,6 +154,7 @@ static int subd(const char *dir, const char *name, const char *debug_subdaemon, int fdnum = 3, i; long max; const char *debug_arg[2] = { NULL, NULL }; + const char *path; close(childmsg[0]); close(execfail[0]); @@ -194,7 +195,8 @@ static int subd(const char *dir, const char *name, const char *debug_subdaemon, if (debug_subdaemon && strends(name, debug_subdaemon)) debug_arg[debug_arg[0] ? 1 : 0] = "--debugger"; #endif - execl(path_join(NULL, dir, name), name, debug_arg[0], debug_arg[1], NULL); + path = path_join(NULL, dir, name); + execl(path, path, debug_arg[0], debug_arg[1], NULL); child_errno_fail: err = errno;