Alexandre Julliard : kernel32: Use __wine_main_environ by default, environ is broken on FreeBSD too.

Alexandre Julliard julliard at winehq.org
Thu Apr 2 10:42:40 CDT 2009


Module: wine
Branch: master
Commit: 7b7f35aee566021f7ec276fec15ee57262780b4a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7b7f35aee566021f7ec276fec15ee57262780b4a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Apr  2 12:00:33 2009 +0200

kernel32: Use __wine_main_environ by default, environ is broken on FreeBSD too.

---

 dlls/kernel32/process.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 0dd7f67..286f0ab 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -58,9 +58,9 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
 
 #ifdef __APPLE__
 extern char **__wine_get_main_environment(void);
-#define environ __wine_get_main_environment()
 #else
-extern char **environ;
+extern char **__wine_main_environ;
+static char **__wine_get_main_environment(void) { return __wine_main_environ; }
 #endif
 
 typedef struct
@@ -280,9 +280,10 @@ static BOOL build_initial_environment(void)
     char **e;
     WCHAR *p, *endptr;
     void *ptr;
+    char **env = __wine_get_main_environment();
 
     /* Compute the total size of the Unix environment */
-    for (e = environ; *e; e++)
+    for (e = env; *e; e++)
     {
         if (is_special_env_var( *e )) continue;
         size += MultiByteToWideChar( CP_UNIXCP, 0, *e, -1, NULL, 0 );
@@ -299,7 +300,7 @@ static BOOL build_initial_environment(void)
     endptr = p + size / sizeof(WCHAR);
 
     /* And fill it with the Unix environment */
-    for (e = environ; *e; e++)
+    for (e = env; *e; e++)
     {
         char *str = *e;
 




More information about the wine-cvs mailing list