[mod_cgi] FreeBSD 9.3/MacOSX does not have pipe2() (fixes #2765)

FreeBSD 9.3 has O_CLOEXEC, but does not have pipe2() until FreeBSD 10.
FreeBSD 10 also adds SOCK_CLOEXEC, so use that as indicator
https://wiki.freebsd.org/AtomicCloseOnExec

Note: FreeBSD 9.3 will soon reach its "extended" EOL date (31 Dec 2016),
so those using FreeBSD 9.3 should consider upgrading.
https://www.freebsd.org/security/security.html#sup

Mac OS X does not have pipe2().  User reported:
  Undefined symbols for architecture x86_64:
    "_pipe2", referenced from:
        _mod_cgi_handle_subrequest in mod_cgi.o

x-ref:
  "Undefined symbols _pipe2"
  https://redmine.lighttpd.net/issues/2765
personal/stbuehler/mod-csrf
Glenn Strauss 6 years ago
parent c74bdf834b
commit 6533056289

@ -36,7 +36,8 @@
#include <stdio.h>
#include <fcntl.h>
#if defined(O_CLOEXEC) && (!defined(__FreeBSD__) || defined(F_DUPFD_CLOEXEC))
#if defined(O_CLOEXEC) && (!defined(__FreeBSD__) || defined(SOCK_CLOEXEC)) \
&& !(defined(__APPLE__) && defined(__MACH__))
#define pipe_cloexec(pipefd) pipe2((pipefd), O_CLOEXEC)
#elif defined FD_CLOEXEC
#define pipe_cloexec(pipefd) \

Loading…
Cancel
Save