-rw-r--r-- | src/fastcgi.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/fastcgi.cc b/src/fastcgi.cc index 8b7668c..63b59f8 100644 --- a/src/fastcgi.cc +++ b/src/fastcgi.cc | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include <sys/types.h> | 2 | #include <sys/types.h> |
3 | #include <sys/stat.h> | 3 | #include <sys/stat.h> |
4 | #include <fastcgi.h> | ||
4 | #include "kingate/fastcgi.h" | 5 | #include "kingate/fastcgi.h" |
5 | #include "kingate/exception.h" | 6 | #include "kingate/exception.h" |
6 | 7 | ||
@@ -15,13 +16,17 @@ namespace kingate { | |||
15 | throw exception(CODEPOINT,"failed to FCGX_Init()"); | 16 | throw exception(CODEPOINT,"failed to FCGX_Init()"); |
16 | _initialized = true; | 17 | _initialized = true; |
17 | } | 18 | } |
18 | sock = FCGX_OpenSocket(s,bl); | 19 | if(!s) { |
19 | if(sock<0) | 20 | sock = FCGI_LISTENSOCK_FILENO; |
20 | throw exception(CODEPOINT,"failed to FCGX_OpenSocket("); | 21 | }else{ |
21 | // TODO: check if there is a ':', not if it starts with ':' | 22 | sock = FCGX_OpenSocket(s,bl); |
22 | if(*s != ':') | 23 | if(sock<0) |
23 | if(chmod(s,0777)) // XXX: configurable. | 24 | throw exception(CODEPOINT,"failed to FCGX_OpenSocket("); |
24 | throw exception(CODEPOINT,"failed to chmod()"); | 25 | // TODO: check if there is a ':', not if it starts with ':' |
26 | if(*s != ':') | ||
27 | if(chmod(s,0777)) // XXX: configurable. | ||
28 | throw exception(CODEPOINT,"failed to chmod()"); | ||
29 | } | ||
25 | } | 30 | } |
26 | fcgi_socket::fcgi_socket(int s) | 31 | fcgi_socket::fcgi_socket(int s) |
27 | : sock(0) { | 32 | : sock(0) { |