From: Brendan Shanks bshanks@codeweavers.com
Reported by Gerald Pfeifer. --- dlls/msv1_0/unixlib.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/msv1_0/unixlib.c b/dlls/msv1_0/unixlib.c index b51dde2ef0a..3003c9c6e54 100644 --- a/dlls/msv1_0/unixlib.c +++ b/dlls/msv1_0/unixlib.c @@ -40,7 +40,11 @@ #include "wine/debug.h" #include "unixlib.h"
+#ifdef __FreeBSD__ +#include <dlfcn.h> +#else extern char **environ; +#endif
WINE_DEFAULT_DEBUG_CHANNEL(ntlm); WINE_DECLARE_DEBUG_CHANNEL(winediag); @@ -160,6 +164,11 @@ static NTSTATUS ntlm_fork( void *args ) struct ntlm_ctx *ctx = params->ctx; posix_spawn_file_actions_t file_actions; int pipe_in[2], pipe_out[2]; +#ifdef __FreeBSD__ + char ***envp = dlsym( RTLD_DEFAULT, "environ" ); +#else + char ***envp = &environ; +#endif
#ifdef HAVE_PIPE2 if (pipe2( pipe_in, O_CLOEXEC ) < 0) @@ -193,7 +202,7 @@ static NTSTATUS ntlm_fork( void *args ) posix_spawn_file_actions_addclose( &file_actions, pipe_in[0] ); posix_spawn_file_actions_addclose( &file_actions, pipe_in[1] );
- if (posix_spawnp( &ctx->pid, params->argv[0], &file_actions, NULL, params->argv, environ )) + if (posix_spawnp( &ctx->pid, params->argv[0], &file_actions, NULL, params->argv, *envp )) { ctx->pid = -1; write( pipe_in[1], "BH\n", 3 );