aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-02-01 14:10:27 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-02-01 14:10:27 -0800
commitb941095f28d13288100dae54e14925ae41fd987c (patch)
tree2ad3064c43c4524b4efb32d387bd685b76c40d32 /src
parent9828aade971a152fe8cfb43d8bfeab311de03845 (diff)
Comments
Diffstat (limited to 'src')
-rw-r--r--src/core/support/env_linux.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/support/env_linux.c b/src/core/support/env_linux.c
index 183bcd2bd0..7bfd8415f8 100644
--- a/src/core/support/env_linux.c
+++ b/src/core/support/env_linux.c
@@ -49,11 +49,19 @@
#include "src/core/support/string.h"
+/* Declare weak symbols for versions of secure_getenv that *may* be
+ * on a users machine. Older libc's call this __secure_getenv, even
+ * older don't support the functionality.
+ *
+ * If a symbol is not present, these will be equal to NULL.
+ */
char *__attribute__((weak)) secure_getenv(const char *name);
char *__attribute__((weak)) __secure_getenv(const char *name);
char *gpr_getenv(const char *name) {
static char *(*getenv_func)(const char *) = secure_getenv;
+ /* Check to see which getenv variant is supported (go from most
+ * to least secure */
if (getenv_func == NULL) {
getenv_func = __secure_getenv;
if (getenv_func == NULL) {