summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2003-09-03 08:15:09 +0000
committerSascha Schumann <sas@php.net>2003-09-03 08:15:09 +0000
commit45a928ef942730236aeefee491f14ee175a46489 (patch)
tree0c07aec57134b9de6c6141738650ed8fbb41ae8c /sapi
parenta283caf3925e8fac6af53519e0a90c795cc1e0a5 (diff)
downloadphp-git-45a928ef942730236aeefee491f14ee175a46489.tar.gz
fix heuristic: if someone passed "-b IP:port", this check would
falsely recognize the parameter as defining only a port.
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 24e001efe2..664c748363 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1111,7 +1111,6 @@ consult the installation file that came with this distribution, or visit \n\
/* for windows, socket listening is broken in the fastcgi library itself
so dissabling this feature on windows till time is available to fix it */
if (bindpath) {
- int port = 0;
/* this must be done to make FCGX_OpenSocket work correctly
bug 23664 */
close(0);
@@ -1119,11 +1118,16 @@ consult the installation file that came with this distribution, or visit \n\
* If just a port is specified, then we prepend a ':' onto the
* path (it's what the fastcgi library expects)
*/
- port = atoi(bindpath);
- if (port) {
- char bindport[32];
- snprintf(bindport, 32, ":%s", bindpath);
- fcgi_fd = FCGX_OpenSocket(bindport, 128);
+
+ if (strchr(bindpath, ':') == NULL) {
+ char *tmp;
+
+ tmp = malloc(strlen(bindpath) + 2);
+ tmp[0] = ':';
+ memcpy(tmp + 1, bindpath, strlen(bindpath) + 1);
+
+ fcgi_fd = FCGX_OpenSocket(tmp, 128);
+ free(tmp);
} else {
fcgi_fd = FCGX_OpenSocket(bindpath, 128);
}