Fixed bug #41291 (FastCGI does not set SO_REUSEADDR). (fmajid at kefta dot com)

This commit is contained in:
Dmitry Stogov 2007-05-10 15:21:02 +00:00
parent fb045249e5
commit 6e8438633b
2 changed files with 12 additions and 0 deletions

2
NEWS
View File

@ -16,6 +16,8 @@ PHP NEWS
- Fixed bug #41304 (compress.zlib temp files left). (Dmitry)
- Fixed bug #41293 (Fixed creation of HTTP_RAW_POST_DATA when there is no
default post handler). (Ilia)
- Fixed bug #41291 (FastCGI does not set SO_REUSEADDR).
(fmajid at kefta dot com, Dmitry)
- Fixed gd build when used with freetype 1.x (Pierre, Tony)
- Fixed bug #41287 (Namespace functions don't allow xmlns definition to be
optional). (Rob)

View File

@ -345,6 +345,13 @@ int fcgi_listen(const char *path, int backlog)
int listen_socket;
sa_t sa;
socklen_t sock_len;
#ifdef SO_REUSEADDR
# ifdef _WIN32
BOOL reuse = 1;
# else
int reuse = 1;
# endif
#endif
if ((s = strchr(path, ':'))) {
port = atoi(s+1);
@ -434,6 +441,9 @@ int fcgi_listen(const char *path, int backlog)
/* Create, bind socket and start listen on it */
if ((listen_socket = socket(sa.sa.sa_family, SOCK_STREAM, 0)) < 0 ||
#ifdef SO_REUSEADDR
setsockopt(listen_socket, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, sizeof(reuse)) < 0 ||
#endif
bind(listen_socket, (struct sockaddr *) &sa, sock_len) < 0 ||
listen(listen_socket, backlog) < 0) {