/[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 91 Revision 93
31#include <sys/wait.h> 31#include <sys/wait.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <fcntl.h> 33#include <fcntl.h>
34#include "sandbox.h" 34#include "sandbox.h"
35 35
36#define SB_BUF_LEN 2048
37
38int cleaned_up = 0; 36int cleaned_up = 0;
39int print_debug = 0; 37int print_debug = 0;
40int stop_called = 0; 38int stop_called = 0;
41 39
42/* Read pids file, and load active pids into an array. Return number of pids in array */ 40/* Read pids file, and load active pids into an array. Return number of pids in array */
98{ 96{
99 int i = 0; 97 int i = 0;
100 int success = 1; 98 int success = 1;
101 int pids_file = -1, num_of_pids = 0; 99 int pids_file = -1, num_of_pids = 0;
102 int *pids_array = NULL; 100 int *pids_array = NULL;
103 char pid_string[255]; 101 char pid_string[SB_BUF_LEN];
104 char *sandbox_pids_file; 102 char *sandbox_pids_file;
105 103
106 /* Generate sandbox pids-file path */ 104 /* Generate sandbox pids-file path */
107 sandbox_pids_file = get_sandbox_pids_file(); 105 sandbox_pids_file = get_sandbox_pids_file();
108 106
236} 234}
237 235
238void get_sandbox_write_envvar(char *buf, char *home_dir, char *portage_tmp_dir, char *var_tmp_dir, char *tmp_dir) 236void get_sandbox_write_envvar(char *buf, char *home_dir, char *portage_tmp_dir, char *var_tmp_dir, char *tmp_dir)
239{ 237{
240 /* bzero out entire buffer then append trailing 0 */ 238 /* bzero out entire buffer then append trailing 0 */
241 memset(buf, 0, SB_BUF_LEN + 1); 239 memset(buf, 0, SB_BUF_LEN);
242 240
243 /* these could go into make.globals later on */ 241 /* these could go into make.globals later on */
244 snprintf(buf, SB_BUF_LEN, 242 snprintf(buf, SB_BUF_LEN,
245 "%s:%s/.gconfd/lock:%s/.bash_history:%s:%s:%s:%s", 243 "%s:%s/.gconfd/lock:%s/.bash_history:%s:%s:%s:%s",
246 "/dev/zero:/dev/fd/:/dev/null:/dev/pts/:" 244 "/dev/zero:/dev/fd/:/dev/null:/dev/pts/:"
255} 253}
256 254
257void get_sandbox_predict_envvar(char *buf, char *home_dir) 255void get_sandbox_predict_envvar(char *buf, char *home_dir)
258{ 256{
259 /* bzero out entire buffer then append trailing 0 */ 257 /* bzero out entire buffer then append trailing 0 */
260 memset(buf, 0, SB_BUF_LEN + 1); 258 memset(buf, 0, SB_BUF_LEN);
261 259
262 /* these should go into make.globals later on */ 260 /* these should go into make.globals later on */
263 snprintf(buf, SB_BUF_LEN, "%s/.:" 261 snprintf(buf, SB_BUF_LEN, "%s/.:"
264 "/usr/lib/python2.0/:" 262 "/usr/lib/python2.0/:"
265 "/usr/lib/python2.1/:" 263 "/usr/lib/python2.1/:"
412 410
413 int *pids_array = NULL; 411 int *pids_array = NULL;
414 int num_of_pids = 0; 412 int num_of_pids = 0;
415 413
416 // char run_arg[255]; 414 // char run_arg[255];
417 char portage_tmp_dir[PATH_MAX];
418 char var_tmp_dir[PATH_MAX];
419 char tmp_dir[PATH_MAX];
420 char sandbox_log[255];
421 char sandbox_debug_log[255];
422 char sandbox_dir[255];
423 char sandbox_lib[255];
424 char sandbox_write_envvar[SB_BUF_LEN + 1];
425 char sandbox_predict_envvar[SB_BUF_LEN + 1];
426 char **sandbox_environ; 415 char **sandbox_environ;
416 char sandbox_log[SB_PATH_MAX];
417 char sandbox_debug_log[SB_PATH_MAX];
418 char sandbox_dir[SB_PATH_MAX];
419 char sandbox_lib[SB_PATH_MAX];
420 char sandbox_rc[SB_PATH_MAX];
427 char *sandbox_pids_file; 421 char *sandbox_pids_file;
428 char sandbox_rc[255]; 422 char portage_tmp_dir[SB_PATH_MAX];
429 char pid_string[255]; 423 char var_tmp_dir[SB_PATH_MAX];
424 char tmp_dir[SB_PATH_MAX];
425 char sandbox_write_envvar[SB_BUF_LEN];
426 char sandbox_predict_envvar[SB_BUF_LEN];
427 char pid_string[SB_BUF_LEN];
430 char **argv_bash = NULL; 428 char **argv_bash = NULL;
431 429
432 char *run_str = "-c"; 430 char *run_str = "-c";
433 char *home_dir = NULL; 431 char *home_dir = NULL;
434 char *tmp_string = NULL; 432 char *tmp_string = NULL;

Legend:
Removed from v.91  
changed lines
  Added in v.93

  ViewVC Help
Powered by ViewVC 1.1.20