diff options
-rw-r--r-- | wrapper/ppswrapper.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wrapper/ppswrapper.c b/wrapper/ppswrapper.c index ab250ba..23a05a9 100644 --- a/wrapper/ppswrapper.c +++ b/wrapper/ppswrapper.c @@ -41,12 +41,20 @@ static struct { static ppsw_t* ppsw_client_get(void) { + const char *ppsw_port = getenv ("PPSW_PORT"); + int port = -1; + if (ppsw_state.client) { ppsw_state.refcnt++; return ppsw_state.client; } - ppsw_state.client = ppsw_client_create (PPSW_PORT); + if (ppsw_port) + port = atoi (ppsw_port); + if (port >= 0 && port < 1024) + port = -1; + + ppsw_state.client = ppsw_client_create (port); if (!ppsw_state.client) return NULL; |