From 4b09d37f66032a9f3f313de30384150d17933bcb Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 23 Mar 2006 10:20:14 +0000 Subject: [PATCH] MTH: Allowed '-b' with UNIX sockets --- sapi/cgi/cgi_main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index b8633c751cf..e711be43749 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -869,6 +869,19 @@ void fastcgi_cleanup(int signal) exit(0); } +#ifndef PHP_WIN32 +static int is_port_number(const char *bindpath) +{ + while (*bindpath) { + if (*bindpath < '0' || *bindpath > '9') { + return 0; + } + bindpath++; + } + return 1; +} +#endif + /* {{{ main */ int main(int argc, char *argv[]) @@ -1104,7 +1117,7 @@ consult the installation file that came with this distribution, or visit \n\ * path (it's what the fastcgi library expects) */ - if (strchr(bindpath, ':') == NULL) { + if (strchr(bindpath, ':') == NULL && is_port_number(bindpath)) { char *tmp; tmp = malloc(strlen(bindpath) + 2);