summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/internal/slibtool_driver_impl.h8
-rw-r--r--src/internal/slibtool_spawn_impl.h4
-rw-r--r--src/logic/slbt_exec_ctx.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 8aaf592..120c2e3 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -107,6 +107,7 @@ struct slbt_driver_ctx_impl {
char ** dargv;
char ** targv;
char ** cargv;
+ char ** envp;
struct slbt_error_info**errinfp;
struct slbt_error_info**erricap;
struct slbt_error_info *erriptr[64];
@@ -138,6 +139,13 @@ static inline struct slbt_driver_ctx_impl * slbt_get_driver_ictx(const struct sl
return 0;
}
+static inline char ** slbt_driver_envp(const struct slbt_driver_ctx * dctx)
+{
+ struct slbt_driver_ctx_impl * ictx;
+ ictx = slbt_get_driver_ictx(dctx);
+ return ictx->envp;
+}
+
static inline int slbt_driver_fdin(const struct slbt_driver_ctx * dctx)
{
struct slbt_fd_ctx fdctx;
diff --git a/src/internal/slibtool_spawn_impl.h b/src/internal/slibtool_spawn_impl.h
index da2e762..cfdd779 100644
--- a/src/internal/slibtool_spawn_impl.h
+++ b/src/internal/slibtool_spawn_impl.h
@@ -30,8 +30,6 @@
#include <spawn.h>
#endif
-extern char ** environ;
-
static inline int slbt_spawn(
struct slbt_exec_ctx * ectx,
bool fwait)
@@ -45,7 +43,7 @@ static inline int slbt_spawn(
ectx->program,
0,0,
ectx->argv,
- ectx->envp ? ectx->envp : environ))
+ ectx->envp))
pid = -1;
#else
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 7b5267a..82961b6 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -136,6 +136,8 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
ictx->ctx.csrc = csrc;
ictx->fdwrapper = (-1);
+ ictx->ctx.envp = slbt_driver_envp(dctx);
+
return ictx;
}