Ticket #2458: 2458-unix.dpatch

File 2458-unix.dpatch, 1.4 KB (added by batterseapower, 4 years ago)
Line 
11 patch for repository darcs.haskell.org:/srv/darcs/packages/unix:
2
3Fri Apr  1 13:19:08 BST 2011  Max Bolingbroke <[email protected]>
4  * Use NSGetEnviron on OS X
5
6New patches:
7
8[Use NSGetEnviron on OS X
9Max Bolingbroke <[email protected]>**20110401121908
10 Ignore-this: e8582c3df56bce3aecdcad08592a82f9
11] {
12hunk ./System/Posix/Env.hsc 58
13 
14 getEnvironmentPrim :: IO [String]
15 getEnvironmentPrim = do
16-  c_environ <- peek c_environ_p
17+  c_environ <- getCEnviron
18   arr <- peekArray0 nullPtr c_environ
19   mapM peekCString arr
20 
21hunk ./System/Posix/Env.hsc 62
22+getCEnviron :: IO (Ptr CString)
23+#if darwin_HOST_OS
24+-- You should not access _environ directly on Darwin in a bundle/shared library.
25+-- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html
26+getCEnviron = nsGetEnviron >>= peek
27+
28+foreign import ccall unsafe "_NSGetEnviron"
29+   nsGetEnviron :: IO (Ptr (Ptr CString))
30+#else
31+getCEnviron = peek c_environ_p
32+
33 foreign import ccall unsafe "&environ"
34    c_environ_p :: Ptr (Ptr CString)
35hunk ./System/Posix/Env.hsc 75
36+#endif
37 
38 -- |'getEnvironment' retrieves the entire environment as a
39 -- list of @(key,value)@ pairs.
40}
41
42Context:
43
44[TAG git migration
45Ian Lynagh <[email protected]>**20110331135044
46 Ignore-this: f484f990e0824737ad31333d2252c29d
47]
48Patch bundle hash:
49eb19ad610639cddb9ddcbcfdc977d64171f83ffe