summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-07-24 21:15:24 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-07-24 21:15:24 -0400
commit0e0d6c2b46837291273f2e1ef7be62a206a997ef (patch)
tree462a1fa00fc138311ca290a28040f0dc4612de82
parent16a0d47fdce2bd6a2c7d63c97fca28b6ba4e3d9b (diff)
downloadbfs-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.
-rw-r--r--util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util.c b/util.c
index 9182a80..aa6f401 100644
--- a/util.c
+++ b/util.c
@@ -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) {