Use _NSGetEnviron instead of environ (see "man environ"). environ isn't
available in a dylib, and with this change, gyp/xcode is able to build libbase
as a dylib.
Review URL: http://codereview.chromium.org/21019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9089 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index a52f608..6dd865b 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -7,15 +7,12 @@
#include "base/process_util.h"
#import <Cocoa/Cocoa.h>
+#include <crt_externs.h>
#include <spawn.h>
#include <string>
#include <sys/types.h>
#include <sys/wait.h>
-extern "C" {
-extern char** environ;
-}
-
namespace base {
bool LaunchApp(const std::vector<std::string>& argv,
@@ -65,7 +62,7 @@
&file_actions,
NULL,
argv_copy,
- environ) == 0);
+ *_NSGetEnviron()) == 0);
posix_spawn_file_actions_destroy(&file_actions);