Remove use of __environ

It has apparently never worked. Fixes #2988
This commit is contained in:
ridiculousfish 2016-04-30 17:46:14 -07:00
parent a897ef0025
commit 58d7c4b388
4 changed files with 1 additions and 36 deletions

View file

@ -675,30 +675,6 @@ else
AC_MSG_RESULT(no)
fi
# Check for __environ symbol
AC_MSG_CHECKING([for __environ symbol])
AC_TRY_LINK(
[
#include <unistd.h>
],
[
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])

View file

@ -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

View file

@ -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++;

View file

@ -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))