/[path-sandbox]/trunk/src/sandbox.c
Gentoo

Diff of /trunk/src/sandbox.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 184 Revision 193
271 char *ld_preload_envvar = NULL; 271 char *ld_preload_envvar = NULL;
272 char *orig_ld_preload_envvar = NULL; 272 char *orig_ld_preload_envvar = NULL;
273 273
274 /* Unset these, as its easier than replacing when setting up our 274 /* Unset these, as its easier than replacing when setting up our
275 * new environment below */ 275 * new environment below */
276 unsetenv(ENV_SANDBOX_ON);
276 unsetenv(ENV_SANDBOX_LIB); 277 unsetenv(ENV_SANDBOX_LIB);
277 unsetenv(ENV_SANDBOX_BASHRC); 278 unsetenv(ENV_SANDBOX_BASHRC);
278 unsetenv(ENV_SANDBOX_LOG); 279 unsetenv(ENV_SANDBOX_LOG);
279 unsetenv(ENV_SANDBOX_DEBUG_LOG); 280 unsetenv(ENV_SANDBOX_DEBUG_LOG);
280 281
314 if (NULL == new_environ) 315 if (NULL == new_environ)
315 return NULL; 316 return NULL;
316 317
317 /* First add our new variables to the beginning - this is due to some 318 /* First add our new variables to the beginning - this is due to some
318 * weirdness that I cannot remember */ 319 * weirdness that I cannot remember */
320 sandbox_setenv(new_environ, ENV_SANDBOX_ON, "1");
319 sandbox_setenv(new_environ, ENV_SANDBOX_LIB, sandbox_info->sandbox_lib); 321 sandbox_setenv(new_environ, ENV_SANDBOX_LIB, sandbox_info->sandbox_lib);
320 sandbox_setenv(new_environ, ENV_SANDBOX_BASHRC, sandbox_info->sandbox_rc); 322 sandbox_setenv(new_environ, ENV_SANDBOX_BASHRC, sandbox_info->sandbox_rc);
321 sandbox_setenv(new_environ, ENV_SANDBOX_LOG, sandbox_info->sandbox_log); 323 sandbox_setenv(new_environ, ENV_SANDBOX_LOG, sandbox_info->sandbox_log);
322 sandbox_setenv(new_environ, ENV_SANDBOX_DEBUG_LOG, 324 sandbox_setenv(new_environ, ENV_SANDBOX_DEBUG_LOG,
323 sandbox_info->sandbox_debug_log); 325 sandbox_info->sandbox_debug_log);
456 458
457 /* set up the required environment variables */ 459 /* set up the required environment variables */
458 if (print_debug) 460 if (print_debug)
459 printf("Setting up the required environment variables.\n"); 461 printf("Setting up the required environment variables.\n");
460 462
461 /* This one should not be child only, as we check above to see
462 * if we are already running (check sandbox_setup_environ).
463 * This needs to be set before calling sandbox_setup_environ(),
464 * else its not set for the child */
465 setenv(ENV_SANDBOX_ON, "1", 0);
466
467 /* Setup the child environment stuff */ 463 /* Setup the child environment stuff */
468 sandbox_environ = sandbox_setup_environ(&sandbox_info); 464 sandbox_environ = sandbox_setup_environ(&sandbox_info);
469 if (NULL == sandbox_environ) { 465 if (NULL == sandbox_environ) {
470 perror("sandbox: Out of memory (environ)"); 466 perror("sandbox: Out of memory (environ)");
471 exit(EXIT_FAILURE); 467 exit(EXIT_FAILURE);

Legend:
Removed from v.184  
changed lines
  Added in v.193

  ViewVC Help
Powered by ViewVC 1.1.20