blob: 2ebfe0ea6a3b590193a3ea0e991f2f186e4a7f14 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
--- lib/cloexec.h.orig 2012-03-26 18:25:19 UTC
+++ lib/cloexec.h
@@ -22,6 +22,7 @@
#ifndef _WIN32
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/param.h>
#include <fcntl.h>
static __inline void fcntl_cloexec(socket_t fd)
{
@@ -55,7 +56,7 @@ static __inline int accept4(int s, struc
static __inline socket_t accept_cloexec(socket_t sockfd, struct sockaddr *addr,
socklen_t *addrlen)
{
-#ifdef SOCK_CLOEXEC
+#if defined(SOCK_CLOEXEC) && __FreeBSD_version > 1000032
return accept4(sockfd, addr, addrlen, SOCK_CLOEXEC);
#else
socket_t fd = accept(sockfd, addr, addrlen);
|