Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Add comment about using SystemNative_Pipe in ForkAndExecProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Dec 1, 2017
1 parent c53b84b commit 2a6c455
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Native/Unix/System.Native/pal_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ extern "C" int32_t SystemNative_ForkAndExecProcess(const char* filename,
// where the parent process uses members of Process, like ProcessName, when the Process
// is still the clone of this one. This is a best-effort attempt, so ignore any errors.
// If the child fails to exec we use the pipe to pass the errno to the parent process.
// NOTE: It's tempting to use SystemNative_Pipe here, as that would simulate pipe2 even
// on platforms that don't have it. But it's potentially problematic, in that if another
// process is launched between the pipe creation and the fcntl call to set CLOEXEC on it,
// that file descriptor will be inherited into the child process, which will in turn cause
// the loop below that waits for that pipe to be closed to loop indefinitely.
#if HAVE_PIPE2
pipe2(waitForChildToExecPipe, O_CLOEXEC);
#endif
Expand Down

0 comments on commit 2a6c455

Please sign in to comment.