From 2dff1fe1e54c2c393d82c9ef1f3fe9a3d8928e29 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Tue, 25 May 2004 18:05:39 +0000
Subject: [PATCH] Moved environ definition to port.h.

---
 include/wine/port.h | 8 ++++++++
 libs/wine/config.c  | 2 +-
 libs/wine/loader.c  | 7 -------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/wine/port.h b/include/wine/port.h
index 31c0a82d0f7..00b77f09c0e 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -172,6 +172,14 @@ struct statvfs
 # define S_IXOTH S_IEXEC
 #endif
 
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
+extern char **environ;
+#endif
+
+
 /****************************************************************
  * Constants
  */
diff --git a/libs/wine/config.c b/libs/wine/config.c
index 957dc25e327..c6ab19e69f5 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -277,7 +277,7 @@ void wine_exec_wine_binary( const char *name, char **argv, char **envp )
 {
     const char *path, *pos, *ptr;
 
-    if (!envp) envp = __wine_main_environ;
+    if (!envp) envp = environ;
     if (!name) name = argv0_name;
 
     /* first, try bin directory */
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 2dcb808a37b..35e5f185c55 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -71,13 +71,6 @@ static const char **dll_paths;
 static int nb_dll_paths;
 static int dll_path_maxlen;
 
-#ifdef __APPLE__
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-#else
-extern char **environ;
-#endif
-
 extern void mmap_init(void);
 
 /* build the dll load path from the WINEDLLPATH variable */
-- 
GitLab