summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorC. McEnroe2021-06-24 17:38:18 -0400
committerC. McEnroe2021-06-25 11:50:14 -0400
commita0cc519829ff7ff5eadc1442439d69fcb87e034a (patch)
treebac9e004e2cfbdcdd4d6fd60d8b93703bebedf63 /irc.c
parent16b34e5cd2135c480ac661a9edcf913dfcabf87d (diff)
Move setting CLOEXEC on socket to ircConnect
Diffstat (limited to 'irc.c')
-rw-r--r--irc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/irc.c b/irc.c
index 41739a3..61d74bb 100644
--- a/irc.c
+++ b/irc.c
@@ -28,6 +28,7 @@
 #include <assert.h>
 #include <err.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <stdarg.h>
@@ -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));