summaryrefslogtreecommitdiff
path: root/common/spio.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-09-19 00:21:28 +0000
committerStef Walter <stef@memberwebs.com>2004-09-19 00:21:28 +0000
commitbd7d023f39b048140221a0fb293eadedc8fa071e (patch)
tree75de9bf25eaaab0003f8a640f92e799fc26ef312 /common/spio.c
parentfdd81151209a04a5ab2535a3c500774f2c70b3cc (diff)
Close file descriptors on exec
Diffstat (limited to 'common/spio.c')
-rw-r--r--common/spio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/spio.c b/common/spio.c
index 8cd315b..91e2da0 100644
--- a/common/spio.c
+++ b/common/spio.c
@@ -125,6 +125,8 @@ int spio_connect(spctx_t* ctx, spio_t* io, const struct sockaddr_any* sany,
setsockopt(io->fd, SOL_SOCKET, SO_SNDTIMEO, &(g_state.timeout), sizeof(g_state.timeout)) == -1)
sp_messagex(ctx, LOG_WARNING, "couldn't set timeouts on connection");
+ fcntl(io->fd, F_SETFD, fcntl(io->fd, F_GETFD, 0) | FD_CLOEXEC);
+
if(connect(io->fd, &SANY_ADDR(*sany), SANY_LEN(*sany)) == -1)
RETURN(-1);