diff options
Diffstat (limited to 'ext/standard/proc_open.c')
-rw-r--r-- | ext/standard/proc_open.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 49755ef868..c285be6484 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -943,6 +943,10 @@ PHP_FUNCTION(proc_open) descriptors[i].mode_flags), mode_string, NULL); #else stream = php_stream_fopen_from_fd(descriptors[i].parentend, mode_string, NULL); +# if defined(F_SETFD) && defined(FD_CLOEXEC) + /* mark the descriptor close-on-exec, so that it won't be inherited by potential other children */ + fcntl(descriptors[i].parentend, F_SETFD, FD_CLOEXEC); +# endif #endif if (stream) { zval *retfp; |