From d0279242ce0e6512db0af8dde2a6b11498898ef4 Mon Sep 17 00:00:00 2001 From: Evgeniy Makhrov Date: Fri, 2 Oct 2015 22:51:58 +0300 Subject: [PATCH] add 'e' flag for fopen() to enable CLOEXEC --- main/streams/plain_wrapper.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 9dbc4246b53..39c629b458f 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -94,6 +94,12 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags) flags |= O_RDONLY; } +#if defined(O_CLOEXEC) + if (strchr(mode, 'e')) { + flags |= O_CLOEXEC; + } +#endif + #if defined(O_NONBLOCK) if (strchr(mode, 'n')) { flags |= O_NONBLOCK;