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

Diff of /trunk/sandbox.c

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

Revision 157 Revision 158
36 char work_dir[SB_PATH_MAX]; 36 char work_dir[SB_PATH_MAX];
37 char var_tmp_dir[SB_PATH_MAX]; 37 char var_tmp_dir[SB_PATH_MAX];
38 char tmp_dir[SB_PATH_MAX]; 38 char tmp_dir[SB_PATH_MAX];
39 char *home_dir; 39 char *home_dir;
40} sandbox_info_t; 40} sandbox_info_t;
41
42static char *tmp_dir;
43 41
44static int print_debug = 0; 42static int print_debug = 0;
45static int stop_called = 0; 43static int stop_called = 0;
46 44
47int sandbox_setup(struct sandbox_info_t *sandbox_info) 45int sandbox_setup(struct sandbox_info_t *sandbox_info)
75 73
76 if (-1 == get_tmp_dir(sandbox_info->tmp_dir)) { 74 if (-1 == get_tmp_dir(sandbox_info->tmp_dir)) {
77 perror("sandbox: Failed to get tmp_dir"); 75 perror("sandbox: Failed to get tmp_dir");
78 return -1; 76 return -1;
79 } 77 }
80 tmp_dir = sandbox_info->tmp_dir;
81 setenv(ENV_TMPDIR, tmp_dir, 1); 78 setenv(ENV_TMPDIR, sandbox_info->tmp_dir, 1);
82 79
83 sandbox_info->home_dir = getenv("HOME"); 80 sandbox_info->home_dir = getenv("HOME");
84 if (!sandbox_info->home_dir) { 81 if (!sandbox_info->home_dir) {
85 sandbox_info->home_dir = tmp_dir; 82 sandbox_info->home_dir = sandbox_info->tmp_dir;
86 setenv("HOME", sandbox_info->home_dir, 1); 83 setenv("HOME", sandbox_info->home_dir, 1);
87 } 84 }
88 85
89 /* Generate sandbox lib path */ 86 /* Generate sandbox lib path */
90 get_sandbox_lib(sandbox_info->sandbox_lib); 87 get_sandbox_lib(sandbox_info->sandbox_lib);
191 "/dev/shm/ngpt:/var/log/scrollkeeper.log:" 188 "/dev/shm/ngpt:/var/log/scrollkeeper.log:"
192 "/usr/tmp/conftest:/usr/lib/conftest:" 189 "/usr/tmp/conftest:/usr/lib/conftest:"
193 "/usr/lib32/conftest:/usr/lib64/conftest:" 190 "/usr/lib32/conftest:/usr/lib64/conftest:"
194 "/usr/tmp/cf:/usr/lib/cf:/usr/lib32/cf:/usr/lib64/cf", 191 "/usr/tmp/cf:/usr/lib/cf:/usr/lib32/cf:/usr/lib64/cf",
195 sandbox_info->home_dir, sandbox_info->home_dir, 192 sandbox_info->home_dir, sandbox_info->home_dir,
196 (NULL != sandbox_info->work_dir) ? sandbox_info->work_dir : tmp_dir, 193 sandbox_info->work_dir,
197 sandbox_info->tmp_dir, sandbox_info->var_tmp_dir, 194 sandbox_info->tmp_dir, sandbox_info->var_tmp_dir,
198 "/tmp/:/var/tmp/"); 195 "/tmp/:/var/tmp/");
199} 196}
200 197
201void get_sandbox_predict_envvar(char *buf, struct sandbox_info_t *sandbox_info) 198void get_sandbox_predict_envvar(char *buf, struct sandbox_info_t *sandbox_info)

Legend:
Removed from v.157  
changed lines
  Added in v.158

  ViewVC Help
Powered by ViewVC 1.1.20