mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Check if getenv() exists
Do not call getenv() on platform which do not support it
This commit is contained in:
parent
7c7bc10bbc
commit
b75a5a5a7a
3 changed files with 6 additions and 0 deletions
|
@ -158,6 +158,7 @@ include(CheckTypeSize)
|
|||
|
||||
CHECK_FUNCTION_EXISTS(bzero HAVE_BZERO)
|
||||
CHECK_FUNCTION_EXISTS(fork HAVE_FORK)
|
||||
CHECK_FUNCTION_EXISTS(getenv HAVE_GETENV)
|
||||
CHECK_FUNCTION_EXISTS(malloc HAVE_MALLOC)
|
||||
CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET)
|
||||
CHECK_FUNCTION_EXISTS(realloc HAVE_REALLOC)
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
/* Define to 1 if you have the `fork' function. */
|
||||
#cmakedefine HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `getenv’ function. */
|
||||
#cmakedefine HAVE_GETENV
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
|
|
|
@ -2097,6 +2097,7 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
|
|||
sizeof(context->http_proxy_address) - 1] = '\0';
|
||||
context->http_proxy_port = info->http_proxy_port;
|
||||
} else {
|
||||
#ifdef HAVE_GETENV
|
||||
p = getenv("http_proxy");
|
||||
if (p) {
|
||||
strncpy(context->http_proxy_address, p,
|
||||
|
@ -2112,6 +2113,7 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
|
|||
*p = '\0';
|
||||
context->http_proxy_port = atoi(p + 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (context->http_proxy_address[0]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue