}
/* clone the environment */
-static Char **env_clone ( Char **oldenv )
+Char **VG_(env_clone) ( Char **oldenv )
{
Char **oldenvp;
Char **newenvp;
/* restore the DATA rlimit for the child */
VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
- envp = env_clone(VG_(client_envp));
+ envp = VG_(env_clone)(VG_(client_envp));
VG_(env_remove_valgrind_env_stuff)( envp );
argv[0] = "/bin/sh";
PRE(sys_execve)
{
Char* path; /* path to executable */
+ Char** envp;
ThreadState* tst;
PRINT("sys_execve ( %p(%s), %p, %p )", ARG1, ARG1, ARG2, ARG3);
VG_(nuke_all_threads_except)( tid, VgSrc_ExitSyscall );
VG_(reap_threads)(tid);
- { // Remove the valgrind-specific stuff from the environment so the
- // child doesn't get vg_preload_core.so, vg_preload_TOOL.so, etc.
- // This is done unconditionally, since if we are tracing the child,
- // stage1/2 will set up the appropriate client environment.
- Char** envp = (Char**)ARG3;
- if (envp != NULL) {
- VG_(env_remove_valgrind_env_stuff)( envp );
- }
+ // Remove the valgrind-specific stuff from the environment so the
+ // child doesn't get vg_preload_core.so, vg_preload_TOOL.so, etc.
+ // This is done unconditionally, since if we are tracing the child,
+ // stage1/2 will set up the appropriate client environment.
+ envp = VG_(env_clone)( (Char**)ARG3 );
+ if (envp != NULL) {
+ VG_(env_remove_valgrind_env_stuff)( envp );
}
if (VG_(clo_trace_children)) {
const Char *val );
extern void VG_(env_unsetenv) ( Char **env, const Char *varname );
extern void VG_(env_remove_valgrind_env_stuff) ( Char** env );
+extern Char **VG_(env_clone) ( Char **env_clone );
// misc
extern Int VG_(poll)( struct vki_pollfd *, UInt nfds, Int timeout);