diff options
author | jilles <jilles@FreeBSD.org> | 2013-09-06 21:02:06 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-09-06 21:02:06 +0000 |
commit | a0c0abfff1f209c44763018cdf616c7fe5f16640 (patch) | |
tree | cc3e6c5d69e4d0eee1e3bcb2c052aeb0be9035c8 /lib/libc/net/nscachedcli.c | |
parent | 015eb27a8b0450258dd29fd9db494e07060a4a45 (diff) | |
download | FreeBSD-src-a0c0abfff1f209c44763018cdf616c7fe5f16640.zip FreeBSD-src-a0c0abfff1f209c44763018cdf616c7fe5f16640.tar.gz |
libc: Use SOCK_CLOEXEC for various internal file descriptors.
This change avoids undesirably passing some internal file descriptors to a
process created (fork+exec) by another thread.
Kernel support for SOCK_CLOEXEC was added in r248534, March 19, 2013.
Diffstat (limited to 'lib/libc/net/nscachedcli.c')
-rw-r--r-- | lib/libc/net/nscachedcli.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/net/nscachedcli.c b/lib/libc/net/nscachedcli.c index b4de0c1..2ceacb7 100644 --- a/lib/libc/net/nscachedcli.c +++ b/lib/libc/net/nscachedcli.c @@ -200,7 +200,7 @@ __open_cached_connection(struct cached_connection_params const *params) assert(params != NULL); - client_socket = _socket(PF_LOCAL, SOCK_STREAM, 0); + client_socket = _socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); client_address.sun_family = PF_LOCAL; strncpy(client_address.sun_path, params->socket_path, sizeof(client_address.sun_path)); |