/[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 263 Revision 265
265 return 0; 265 return 0;
266} 266}
267 267
268/* We setup the environment child side only to prevent issues with 268/* We setup the environment child side only to prevent issues with
269 * setting LD_PRELOAD parent side */ 269 * setting LD_PRELOAD parent side */
270char **sandbox_setup_environ(struct sandbox_info_t *sandbox_info) 270char **sandbox_setup_environ(struct sandbox_info_t *sandbox_info, bool interactive)
271{ 271{
272 int env_size = 0; 272 int env_size = 0;
273 int have_ld_preload = 0; 273 int have_ld_preload = 0;
274 274
275 char **new_environ; 275 char **new_environ;
335 sandbox_setenv(new_environ, ENV_SANDBOX_LIB, sandbox_info->sandbox_lib); 335 sandbox_setenv(new_environ, ENV_SANDBOX_LIB, sandbox_info->sandbox_lib);
336 sandbox_setenv(new_environ, ENV_SANDBOX_BASHRC, sandbox_info->sandbox_rc); 336 sandbox_setenv(new_environ, ENV_SANDBOX_BASHRC, sandbox_info->sandbox_rc);
337 sandbox_setenv(new_environ, ENV_SANDBOX_LOG, sandbox_info->sandbox_log); 337 sandbox_setenv(new_environ, ENV_SANDBOX_LOG, sandbox_info->sandbox_log);
338 sandbox_setenv(new_environ, ENV_SANDBOX_DEBUG_LOG, 338 sandbox_setenv(new_environ, ENV_SANDBOX_DEBUG_LOG,
339 sandbox_info->sandbox_debug_log); 339 sandbox_info->sandbox_debug_log);
340 /* Is this an interactive session? */
341 if (interactive)
342 sandbox_setenv(new_environ, ENV_SANDBOX_INTRACTV, "1");
340 /* Just set the these if not already set so that is_env_on() work */ 343 /* Just set the these if not already set so that is_env_on() work */
341 if (!getenv(ENV_SANDBOX_VERBOSE)) 344 if (!getenv(ENV_SANDBOX_VERBOSE))
342 sandbox_setenv(new_environ, ENV_SANDBOX_VERBOSE, "1"); 345 sandbox_setenv(new_environ, ENV_SANDBOX_VERBOSE, "1");
343 if (!getenv(ENV_SANDBOX_DEBUG)) 346 if (!getenv(ENV_SANDBOX_DEBUG))
344 sandbox_setenv(new_environ, ENV_SANDBOX_DEBUG, "0"); 347 sandbox_setenv(new_environ, ENV_SANDBOX_DEBUG, "0");
479 /* set up the required environment variables */ 482 /* set up the required environment variables */
480 if (print_debug) 483 if (print_debug)
481 printf("Setting up the required environment variables.\n"); 484 printf("Setting up the required environment variables.\n");
482 485
483 /* Setup the child environment stuff */ 486 /* Setup the child environment stuff */
484 sandbox_environ = sandbox_setup_environ(&sandbox_info); 487 sandbox_environ = sandbox_setup_environ(&sandbox_info, print_debug);
485 if (NULL == sandbox_environ) { 488 if (NULL == sandbox_environ) {
486 perror("sandbox: Out of memory (environ)"); 489 perror("sandbox: Out of memory (environ)");
487 exit(EXIT_FAILURE); 490 exit(EXIT_FAILURE);
488 } 491 }
489 492

Legend:
Removed from v.263  
changed lines
  Added in v.265

  ViewVC Help
Powered by ViewVC 1.1.20