Sprinkle CLOEXEC around.

This commit is contained in:
Ian Gulliver
2016-02-23 12:00:17 -08:00
parent f676cc531a
commit 77ee1422c1
3 changed files with 4 additions and 4 deletions

View File

@@ -54,7 +54,7 @@ static void outgoing_connect_next(struct outgoing *outgoing) {
assert(getnameinfo(outgoing->addr->ai_addr, outgoing->addr->ai_addrlen, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0);
fprintf(stderr, "O %s: Connecting to %s/%s...\n", outgoing->id, hbuf, sbuf);
outgoing->peer.fd = socket(outgoing->addr->ai_family, outgoing->addr->ai_socktype | SOCK_NONBLOCK, outgoing->addr->ai_protocol);
outgoing->peer.fd = socket(outgoing->addr->ai_family, outgoing->addr->ai_socktype | SOCK_NONBLOCK | SOCK_CLOEXEC, outgoing->addr->ai_protocol);
assert(outgoing->peer.fd >= 0);
int result = connect(outgoing->peer.fd, outgoing->addr->ai_addr, outgoing->addr->ai_addrlen);