From: foobar Date: Tue, 18 Jan 2005 15:45:51 +0000 (+0000) Subject: MFH: - Use FD_CLOEXEC with fcntl() and make sure it is always defined X-Git-Tag: php-5.0.4RC1~317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=706ba12284172157df95077b0d7a2ff7888f4419;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 15cd5d7747..21de0a8494 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -166,8 +166,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 {