Commit:    5d61e56dd7e19b82abde23f83b203449a48cc91a
Author:    Jerome Loyet <f...@php.net>         Wed, 23 May 2012 11:52:04 +0200
Parents:   812d2481935185eeeabb2c1fe2d7eafd76fc7359
Branches:  PHP-5.3

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=5d61e56dd7e19b82abde23f83b203449a48cc91a

Log:
- Fixed bug #61026 (FPM pools can listen on the same address)

Bugs:
https://bugs.php.net/61026

Changed paths:
  M  NEWS
  M  sapi/fpm/fpm/fpm_conf.c


Diff:
diff --git a/NEWS b/NEWS
index 13ac964..7542724 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP                                                             
           NEWS
        . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat)
   . Fixed bug #61295 (php-fpm should not fail with commented 'user'
     for non-root start). (fat)
+  . Fixed bug #61026 (FPM pools can listen on the same address). (fat)
 
 - XML Writer:
   . Fixed bug #62064 (memory leak in the XML Writer module). 
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 0b2c5ae..a4283a2 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -704,7 +704,7 @@ static int fpm_evaluate_full_path(char **path, struct 
fpm_worker_pool_s *wp, cha
 
 static int fpm_conf_process_all_pools() /* {{{ */
 {
-       struct fpm_worker_pool_s *wp;
+       struct fpm_worker_pool_s *wp, *wp2;
 
        if (!fpm_worker_all_pools) {
                zlog(ZLOG_ERROR, "No pool defined. at least one pool section 
must be specified in config file");
@@ -1044,6 +1044,20 @@ static int fpm_conf_process_all_pools() /* {{{ */
                        }
                }
        }
+
+       /* ensure 2 pools do not use the same listening address */
+       for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
+               for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2->next) {
+                       if (wp == wp2) {
+                               continue;
+                       }
+
+                       if (wp->config->listen_address && 
*wp->config->listen_address && wp2->config->listen_address && 
*wp2->config->listen_address && !strcmp(wp->config->listen_address, 
wp2->config->listen_address)) {
+                               zlog(ZLOG_ERROR, "[pool %s] unable to set 
listen address as it's already used in another pool '%s'", wp2->config->name, 
wp->config->name);
+                               return -1;
+                       }
+               }
+       }
        return 0;
 }
 /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to