/[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 147 Revision 152
44static int print_debug = 0; 44static int print_debug = 0;
45static int stop_called = 0; 45static int stop_called = 0;
46 46
47int sandbox_setup(struct sandbox_info_t *sandbox_info) 47int sandbox_setup(struct sandbox_info_t *sandbox_info)
48{ 48{
49 /* Do not resolve symlinks, etc .. libsandbox will handle that. */
49 if (NULL == realpath(getenv(ENV_PORTAGE_TMPDIR) ? getenv(ENV_PORTAGE_TMPDIR) 50 if (1 != is_dir(getenv(ENV_PORTAGE_TMPDIR) ? getenv(ENV_PORTAGE_TMPDIR)
50 : PORTAGE_TMPDIR, 51 : PORTAGE_TMPDIR, 1)) {
51 sandbox_info->portage_tmp_dir)) {
52 perror("sandbox: Failed to get portage_tmp_dir"); 52 perror("sandbox: Failed to get portage_tmp_dir");
53 return -1; 53 return -1;
54 } 54 }
55 snprintf(sandbox_info->portage_tmp_dir, SB_PATH_MAX, "%s",
56 getenv(ENV_PORTAGE_TMPDIR) ? getenv(ENV_PORTAGE_TMPDIR)
57 : PORTAGE_TMPDIR);
55 setenv(ENV_PORTAGE_TMPDIR, sandbox_info->portage_tmp_dir, 1); 58 setenv(ENV_PORTAGE_TMPDIR, sandbox_info->portage_tmp_dir, 1);
56 59
57 if (NULL == realpath(VAR_TMPDIR, sandbox_info->var_tmp_dir)) { 60 /* Do not resolve symlinks, etc .. libsandbox will handle that. */
61 if (1 != is_dir(VAR_TMPDIR, 1)) {
58 perror("sandbox: Failed to get var_tmp_dir"); 62 perror("sandbox: Failed to get var_tmp_dir");
59 return -1; 63 return -1;
60 } 64 }
65 snprintf(sandbox_info->var_tmp_dir, SB_PATH_MAX, "%s", VAR_TMPDIR);
61 66
62 if (-1 == get_tmp_dir(sandbox_info->tmp_dir)) { 67 if (-1 == get_tmp_dir(sandbox_info->tmp_dir)) {
63 perror("sandbox: Failed to get tmp_dir"); 68 perror("sandbox: Failed to get tmp_dir");
64 return -1; 69 return -1;
65 } 70 }

Legend:
Removed from v.147  
changed lines
  Added in v.152

  ViewVC Help
Powered by ViewVC 1.1.20