From 58d7c4b388067771e0ce1cf0dffd376c6b7fb9f2 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 30 Apr 2016 17:46:14 -0700 Subject: [PATCH] Remove use of __environ It has apparently never worked. Fixes #2988 --- configure.ac | 24 ------------------------ osx/config.h | 3 --- src/env.cpp | 4 +--- src/fallback.cpp | 6 ------ 4 files changed, 1 insertion(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index 87bf46b7c..0236fc8a1 100644 --- a/configure.ac +++ b/configure.ac @@ -675,30 +675,6 @@ else AC_MSG_RESULT(no) fi -# Check for __environ symbol -AC_MSG_CHECKING([for __environ symbol]) -AC_TRY_LINK( - [ - #include - ], - [ - extern char **__environ; - char **tmp = __environ; - exit(tmp!=0); - ], - have___environ=yes, - have___environ=no -) -if test "$have___environ" = yes; then - AC_MSG_RESULT(yes) - AC_DEFINE( - [HAVE___ENVIRON], - [1], - [Define to 1 if the __environ symbol is exported.] - ) -else - AC_MSG_RESULT(no) -fi # Check for sys_errlist AC_MSG_CHECKING([for sys_errlist array]) diff --git a/osx/config.h b/osx/config.h index 0a5530168..fd61d2730 100644 --- a/osx/config.h +++ b/osx/config.h @@ -206,9 +206,6 @@ /* Define to 1 if the _sys_errs array is available. */ /* #undef HAVE__SYS__ERRS */ -/* Define to 1 if the __environ symbol is exported. */ -/* #undef HAVE___ENVIRON */ - /* Define to 1 to disable ncurses macros that conflict with the STL */ #define NCURSES_NOMACROS 1 diff --git a/src/env.cpp b/src/env.cpp index 40af30bfb..e4829a463 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -45,8 +45,6 @@ /// At init, we read all the environment variables from this array. extern char **environ; -/// This should be the same thing as \c environ, but it is possible only one of the two work... -extern char **__environ; bool g_log_forks = false; bool g_use_posix_spawn = false; // will usually be set to true @@ -311,7 +309,7 @@ void env_init(const struct config_paths_t *paths /* or NULL */) { // Import environment variables. Walk backwards so that the first one out of any duplicates wins // (#2784). wcstring key, val; - const char *const *envp = (environ ? environ : __environ); + const char *const *envp = environ; size_t i = 0; while (envp && envp[i]) { i++; diff --git a/src/fallback.cpp b/src/fallback.cpp index e3dcfed0b..b53aec741 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -46,12 +46,6 @@ #include "fallback.h" // IWYU pragma: keep #include "util.h" // IWYU pragma: keep -#ifndef HAVE___ENVIRON - -char **__environ = 0; - -#endif - #ifdef TPUTS_KLUDGE int tputs(const char *str, int affcnt, int (*fish_putc)(tputs_arg_t))