From 2f9b04b0d92219b7cf77d95889788d95482cbbc4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 2 Feb 2017 14:35:45 +1030 Subject: [PATCH] subdaemon: start fds at 3 not 4. Signed-off-by: Rusty Russell --- lightningd/handshake/handshake.c | 6 +++--- lightningd/subdaemon.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lightningd/handshake/handshake.c b/lightningd/handshake/handshake.c index fe067df70..49798e1b7 100644 --- a/lightningd/handshake/handshake.c +++ b/lightningd/handshake/handshake.c @@ -24,7 +24,7 @@ #include #include -/* Stdout == status, stdin == requests, 3 == client */ +/* Stdout == status, stdin == requests, 3 == hsmfd */ #define STATUS_FD STDOUT_FILENO #define REQ_FD STDIN_FILENO @@ -965,12 +965,12 @@ static void responder(int fd, } #ifndef TESTING -/* We expect hsmfd as fd 4, then a request then the clientfd */ +/* We expect hsmfd as fd 3, then a request then the clientfd */ int main(int argc, char *argv[]) { u8 *msg; struct pubkey my_id, their_id; - int hsmfd = 4, clientfd; + int hsmfd = 3, clientfd; struct secret ck, rk, sk; struct crypto_state *cs; diff --git a/lightningd/subdaemon.c b/lightningd/subdaemon.c index fa09fb593..82c8f70a2 100644 --- a/lightningd/subdaemon.c +++ b/lightningd/subdaemon.c @@ -77,7 +77,7 @@ static int subdaemon(const char *dir, const char *name, goto close_execfail_fail; if (childpid == 0) { - int fdnum = 4; + int fdnum = 3; if (reqfd) close(childreq[0]);