summaryrefslogtreecommitdiff
path: root/src/pal/src/synchmgr/synchmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/synchmgr/synchmanager.cpp')
-rw-r--r--src/pal/src/synchmgr/synchmanager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pal/src/synchmgr/synchmanager.cpp b/src/pal/src/synchmgr/synchmanager.cpp
index d836a177bb..73b5644dbd 100644
--- a/src/pal/src/synchmgr/synchmanager.cpp
+++ b/src/pal/src/synchmgr/synchmanager.cpp
@@ -3525,12 +3525,22 @@ namespace CorUnix
}
#else // !CORECLR
int rgiPipe[] = { -1, -1 };
- if (pipe(rgiPipe) == -1)
+ int pipeRv =
+#if HAVE_PIPE2
+ pipe2(rgiPipe, O_CLOEXEC);
+#else
+ pipe(rgiPipe);
+#endif // HAVE_PIPE2
+ if (pipeRv == -1)
{
ERROR("Unable to create the process pipe\n");
fRet = false;
goto CPP_exit;
}
+#if !HAVE_PIPE2
+ fcntl(rgiPipe[0], F_SETFD, FD_CLOEXEC); // make pipe non-inheritable, if possible
+ fcntl(rgiPipe[1], F_SETFD, FD_CLOEXEC);
+#endif // !HAVE_PIPE2
#endif // !CORECLR
#if HAVE_KQUEUE && !HAVE_BROKEN_FIFO_KEVENT