From: foobar Date: Tue, 18 Jan 2005 15:45:01 +0000 (+0000) Subject: MFH: - Use FD_CLOEXEC with fcntl() and make sure it is always defined X-Git-Tag: php-4.3.11RC1~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2572c0a0e3591b1c6633950b89642b9e64f7b1ae;p=php MFH: - Use FD_CLOEXEC with fcntl() and make sure it is always defined --- diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 8dcfca7976..53188d871f 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -162,8 +162,11 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC) flock(data->fd, LOCK_EX); #ifdef F_SETFD - if (fcntl(data->fd, F_SETFD, 1)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "fcntl(%d, F_SETFD, 1) failed: %s (%d)", data->fd, strerror(errno), errno); +#ifndef FD_CLOEXEC +#define FD_CLOEXEC 1 +#endif + if (fcntl(data->fd, F_SETFD, FD_CLOEXEC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "fcntl(%d, F_SETFD, FD_CLOEXEC) failed: %s (%d)", data->fd, strerror(errno), errno); } #endif } else {