From a0cc519829ff7ff5eadc1442439d69fcb87e034a Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 24 Jun 2021 17:38:18 -0400 Subject: Move setting CLOEXEC on socket to ircConnect --- chat.c | 1 - irc.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/chat.c b/chat.c index 170094f..873eed9 100644 --- a/chat.c +++ b/chat.c @@ -338,7 +338,6 @@ int main(int argc, char *argv[]) { signal(SIGTERM, signalHandler); signal(SIGCHLD, signalHandler); - fcntl(irc, F_SETFD, FD_CLOEXEC); bool pipes = !self.kiosk && !self.restricted; if (pipes) { int error = pipe(utilPipe) || pipe(execPipe); diff --git a/irc.c b/irc.c index 41739a3..61d74bb 100644 --- a/irc.c +++ b/irc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -157,6 +158,7 @@ int ircConnect(const char *bindHost, const char *host, const char *port) { if (sock < 0) err(EX_UNAVAILABLE, "%s:%s", host, port); freeaddrinfo(head); + fcntl(sock, F_SETFD, FD_CLOEXEC); error = tls_connect_socket(client, sock, host); if (error) errx(EX_PROTOCOL, "tls_connect: %s", tls_error(client)); -- cgit 1.4.1