channeld: handle signals during select().

We're about to add SIGUSR1, don't get upset if it happens.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-05 14:39:16 +10:30
parent 4b38696613
commit 00a874d4a4

View File

@@ -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)) {