diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-17 14:09:16 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-17 14:09:16 +0000 |
commit | 7a1d5f307d88d8cf6bbf25bb465693a43809dbdd (patch) | |
tree | 772bac241c05c500bdb3b6c573b6ca3e9e5b9575 /src/app.c | |
parent | 8dc1f57b1a59dfa4b064b00ef065e40f1df063fd (diff) |
Filter cmd-line env vars.
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -2109,6 +2109,9 @@ execute_cmdline_lwp (App *app, char **argv, gboolean attach_dbg, GError **error) } if (found) { /* override with the user's cmdline var */ + if (strcmp (env[n], "LD_PRELOAD") == 0) + have_preload = TRUE; + continue; } @@ -2130,8 +2133,20 @@ execute_cmdline_lwp (App *app, char **argv, gboolean attach_dbg, GError **error) envp[i++] = g_strconcat ("LD_PRELOAD=", lib, NULL); if (! have_socket) envp[i++] = g_strconcat ("LWP_PATH=unix:", path, NULL); - while (n_client_env--) - envp[i++] = g_strdup (*argv++); + while (n_client_env--) { + char *equals = strchr (*argv, '='); + g_assert (equals != NULL); + *equals = '\0'; + if (strcmp (*argv, "LD_PRELOAD") == 0) { + envp[i++] = g_strdup_printf ("LD_PRELOAD=%s:%s", lib, equals+1); + } else if (strcmp (*argv, "LWP_PATH") == 0) { + /* ignore */ + } else { + *equals = '='; + envp[i++] = g_strdup (*argv); + } + argv++; + } envp[i] = NULL; g_strfreev (env); |