/[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 96 Revision 97
456 /* determine the location of all the sandbox support files */ 456 /* determine the location of all the sandbox support files */
457 if (print_debug) 457 if (print_debug)
458 printf("Detection of the support files.\n"); 458 printf("Detection of the support files.\n");
459 459
460 /* Generate base sandbox path */ 460 /* Generate base sandbox path */
461 snprintf(sandbox_dir, SB_PATH_MAX, "%s/",
461 tmp_string = get_sandbox_path(argv[0]); 462 get_sandbox_path(argv[0]));
462 strncpy(sandbox_dir, tmp_string, 254);
463 if (tmp_string)
464 free(tmp_string);
465 tmp_string = NULL;
466 strcat(sandbox_dir, "/");
467 463
468 /* Generate sandbox lib path */ 464 /* Generate sandbox lib path */
465 snprintf(sandbox_lib, SB_PATH_MAX, "%s",
469 tmp_string = get_sandbox_lib(sandbox_dir); 466 get_sandbox_lib(sandbox_dir));
470 strncpy(sandbox_lib, tmp_string, 254);
471 if (tmp_string)
472 free(tmp_string);
473 tmp_string = NULL;
474 467
475 /* Generate sandbox pids-file path */ 468 /* Generate sandbox pids-file path */
476 sandbox_pids_file = get_sandbox_pids_file(); 469 sandbox_pids_file = get_sandbox_pids_file();
477 470
478 /* Generate sandbox bashrc path */ 471 /* Generate sandbox bashrc path */
472 snprintf(sandbox_rc, SB_PATH_MAX, "%s",
479 tmp_string = get_sandbox_rc(sandbox_dir); 473 get_sandbox_rc(sandbox_dir));
480 strncpy(sandbox_rc, tmp_string, 254);
481 if (tmp_string)
482 free(tmp_string);
483 tmp_string = NULL;
484 474
485 /* verify the existance of required files */ 475 /* verify the existance of required files */
486 if (print_debug) 476 if (print_debug)
487 printf("Verification of the required files.\n"); 477 printf("Verification of the required files.\n");
488 478
500 /* set up the required environment variables */ 490 /* set up the required environment variables */
501 if (print_debug) 491 if (print_debug)
502 printf("Setting up the required environment variables.\n"); 492 printf("Setting up the required environment variables.\n");
503 493
504 /* Generate sandbox log full path */ 494 /* Generate sandbox log full path */
505 tmp_string = get_sandbox_log(); 495 snprintf(sandbox_log, SB_PATH_MAX, "%s",
506 strncpy(sandbox_log, tmp_string, 254); 496 get_sandbox_log());
507 if (tmp_string)
508 free(tmp_string);
509 tmp_string = NULL;
510 497
511 sprintf(pid_string, "%d", getpid()); 498 /* Generate sandbox debug log full path */
512 snprintf(sandbox_debug_log, sizeof(sandbox_debug_log), "%s%s%s", 499 snprintf(sandbox_debug_log, SB_PATH_MAX, "%s",
513 DEBUG_LOG_FILE_PREFIX, pid_string, LOG_FILE_EXT); 500 get_sandbox_debug_log());
514 501
515 home_dir = getenv("HOME"); 502 home_dir = getenv("HOME");
516 if (!home_dir) { 503 if (!home_dir) {
517 home_dir = "/tmp"; 504 home_dir = "/tmp";
518 setenv("HOME", home_dir, 1); 505 setenv("HOME", home_dir, 1);

Legend:
Removed from v.96  
changed lines
  Added in v.97

  ViewVC Help
Powered by ViewVC 1.1.20