Skip to content

Commit

Permalink
[mod_cgi] FreeBSD 9.3/MacOSX does not have pipe2() (fixes #2765)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gstrauss committed Nov 24, 2016
1 parent c74bdf8 commit 6533056
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mod_cgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit 6533056

Please sign in to comment.