diff --git a/lib/libc/csu/ignore_init.c b/lib/libc/csu/ignore_init.c index 60c45d7e735f..346409e3f370 100644 --- a/lib/libc/csu/ignore_init.c +++ b/lib/libc/csu/ignore_init.c @@ -117,8 +117,6 @@ handle_static_init(int argc, char **argv, char **env) } } -extern char **environ; - static void handle_argv(int argc, char *argv[], char **env) { diff --git a/lib/libc/gen/auxv.c b/lib/libc/gen/auxv.c index 2f043f8814cf..29b3d6929144 100644 --- a/lib/libc/gen/auxv.c +++ b/lib/libc/gen/auxv.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; extern int _DYNAMIC; #pragma weak _DYNAMIC diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index 2c703bb4e73e..f1d69e147719 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; - static const char execvPe_err_preamble[] = "execvP: "; static const char execvPe_err_trailer[] = ": path too long\n"; diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index c5373077f3ae..f0b1a61c2803 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -53,8 +53,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; - struct pid { SLIST_ENTRY(pid) next; FILE *fp; diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index 909db9a60a02..7dc0ade5b309 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; - struct __posix_spawnattr { short sa_flags; pid_t sa_pgroup; diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 5ceaf439d839..c0ed0126db6a 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -401,8 +401,6 @@ __libc_free_tls(void *tcb __unused, size_t tcbsize __unused, #endif /* PIC */ -extern char **environ; - void _init_tls(void) { diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 67750d354f22..228eb5c0945f 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -39,6 +39,8 @@ #include #include +extern char **environ; + /* * The kernel doesn't expose PID_MAX to the user space. Save it here * to allow to run a newer world on a pre-1400079 kernel. diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index ed0c9efcba6d..7ca27ab710c4 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" - +#include "libc_private.h" static const char CorruptEnvFindMsg[] = "environment corrupt; unable to find "; static const char CorruptEnvValueMsg[] = @@ -56,7 +56,6 @@ static const char CorruptEnvValueMsg[] = * intEnviron: Internally-built environ. Exposed via environ during * (re)builds of the environment. */ -extern char **environ; static char **origEnviron; static char **intEnviron = NULL; static int environSize = 0;