opnsense-ports/comms/openobex/files/patch-lib_cloexec.h
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

19 lines
614 B
C

--- lib/cloexec.h.orig 2012-03-26 20:25:19.000000000 +0200
+++ lib/cloexec.h 2013-05-06 23:36:45.087537539 +0200
@@ -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 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);