aboutsummaryrefslogtreecommitdiffstats
path: root/src/gather.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gather.c')
-rw-r--r--src/gather.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gather.c b/src/gather.c
index 2eb7cbc..277f1b5 100644
--- a/src/gather.c
+++ b/src/gather.c
@@ -62,7 +62,7 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
int i, j, seen = 0;
FILE *f = NULL;
const char *argv[5];
- const char *envp[4];
+ const char *envp[5];
char *line = NULL, *p, *q = NULL;
const char **depends = NULL, **depends_temp;
size_t ndepends = 0, ndepends_alloced = 0;
@@ -162,10 +162,20 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
argv[i++] = ent_filename;
argv[i] = NULL;
- envp[0] = "LD_TRACE_LOADED_OBJECTS=1";
- envp[1] = "LD_TRACE_PRELINKING=1";
- envp[2] = "LD_WARN=";
- envp[3] = NULL;
+
+ j = 0;
+ if(etype == ET_EXEC && ld_preload)
+ {
+ p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload) + 1);
+ strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
+ envp[j++] = p;
+ }
+
+ envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
+ envp[j++] = "LD_TRACE_PRELINKING=1";
+ envp[j++] = "LD_WARN=";
+ envp[j] = NULL;
+
f = execve_open (dl, (char * const *)argv, (char * const *)envp);
if (f == NULL)
goto error_out;