diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-07-24 21:15:24 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-07-24 21:15:24 -0400 |
commit | 0e0d6c2b46837291273f2e1ef7be62a206a997ef (patch) | |
tree | 462a1fa00fc138311ca290a28040f0dc4612de82 /util.c | |
parent | 16a0d47fdce2bd6a2c7d63c97fca28b6ba4e3d9b (diff) | |
download | bfs-0e0d6c2b46837291273f2e1ef7be62a206a997ef.tar.xz |
util: macOS doesn't have pipe2()
The code was testing for BSD, since all the normal BSDs have it. But
until recently, <sys/param.h> wasn't included, so BSD was undefined even
on platforms that define it. Now that it is defined appropriately,
exclude macOS specifically.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -25,6 +25,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> @@ -120,7 +121,7 @@ int dup_cloexec(int fd) { } int pipe_cloexec(int pipefd[2]) { -#if __linux__ || BSD +#if __linux__ || (BSD && !__APPLE__) return pipe2(pipefd, O_CLOEXEC); #else if (pipe(pipefd) != 0) { |