From 00a874d4a4ee33775eaf775bdc3c05115e1422d0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 5 Feb 2018 14:39:16 +1030 Subject: [PATCH] channeld: handle signals during select(). We're about to add SIGUSR1, don't get upset if it happens. Signed-off-by: Rusty Russell --- channeld/channel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/channeld/channel.c b/channeld/channel.c index 8f04a8daa..256b04c87 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -2653,9 +2653,13 @@ int main(int argc, char *argv[]) } else wptr = NULL; - if (select(nfds, &rfds, wptr, NULL, tptr) < 0) + if (select(nfds, &rfds, wptr, NULL, tptr) < 0) { + /* Signals OK, eg. SIGUSR1 */ + if (errno == EINTR) + continue; status_failed(STATUS_FAIL_INTERNAL_ERROR, "select failed: %s", strerror(errno)); + } /* Try writing out encrypted packet if any (don't block!) */ if (wptr && FD_ISSET(PEER_FD, wptr)) {