/[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 280 Revision 282
59 return -1; 59 return -1;
60 } 60 }
61 } 61 }
62 62
63 /* Do not resolve symlinks, etc .. libsandbox will handle that. */ 63 /* Do not resolve symlinks, etc .. libsandbox will handle that. */
64 if (1 != rc_is_dir(VAR_TMPDIR, 1)) { 64 if (!rc_is_dir(VAR_TMPDIR, TRUE)) {
65 perror("sandbox: Failed to get var_tmp_dir"); 65 perror("sandbox: Failed to get var_tmp_dir");
66 return -1; 66 return -1;
67 } 67 }
68 snprintf(sandbox_info->var_tmp_dir, SB_PATH_MAX, "%s", VAR_TMPDIR); 68 snprintf(sandbox_info->var_tmp_dir, SB_PATH_MAX, "%s", VAR_TMPDIR);
69 69
85 /* Generate sandbox bashrc path */ 85 /* Generate sandbox bashrc path */
86 get_sandbox_rc(sandbox_info->sandbox_rc); 86 get_sandbox_rc(sandbox_info->sandbox_rc);
87 87
88 /* Generate sandbox log full path */ 88 /* Generate sandbox log full path */
89 get_sandbox_log(sandbox_info->sandbox_log); 89 get_sandbox_log(sandbox_info->sandbox_log);
90 if (1 == rc_file_exists(sandbox_info->sandbox_log)) { 90 if (rc_file_exists(sandbox_info->sandbox_log)) {
91 if (-1 == unlink(sandbox_info->sandbox_log)) { 91 if (-1 == unlink(sandbox_info->sandbox_log)) {
92 perror("sandbox: Could not unlink old log file"); 92 perror("sandbox: Could not unlink old log file");
93 return -1; 93 return -1;
94 } 94 }
95 } 95 }
96 96
97 /* Generate sandbox debug log full path */ 97 /* Generate sandbox debug log full path */
98 get_sandbox_debug_log(sandbox_info->sandbox_debug_log); 98 get_sandbox_debug_log(sandbox_info->sandbox_debug_log);
99 if (1 == rc_file_exists(sandbox_info->sandbox_debug_log)) { 99 if (rc_file_exists(sandbox_info->sandbox_debug_log)) {
100 if (-1 == unlink(sandbox_info->sandbox_debug_log)) { 100 if (-1 == unlink(sandbox_info->sandbox_debug_log)) {
101 perror("sandbox: Could not unlink old debug log file"); 101 perror("sandbox: Could not unlink old debug log file");
102 return -1; 102 return -1;
103 } 103 }
104 } 104 }
112 char *beep_count_env = NULL; 112 char *beep_count_env = NULL;
113 int i, color, beep_count = 0; 113 int i, color, beep_count = 0;
114 long len = 0; 114 long len = 0;
115 char *buffer = NULL; 115 char *buffer = NULL;
116 116
117 if (1 != rc_is_file(sandbox_log, 0)) { 117 if (!rc_is_file(sandbox_log, FALSE)) {
118 perror("sandbox: Log file is not a regular file"); 118 perror("sandbox: Log file is not a regular file");
119 return 0; 119 return 0;
120 } 120 }
121 121
122 sandbox_log_file = open(sandbox_log, O_RDONLY); 122 sandbox_log_file = open(sandbox_log, O_RDONLY);
488 /* verify the existance of required files */ 488 /* verify the existance of required files */
489 if (print_debug) 489 if (print_debug)
490 printf("Verification of the required files.\n"); 490 printf("Verification of the required files.\n");
491 491
492#ifndef SB_HAVE_MULTILIB 492#ifndef SB_HAVE_MULTILIB
493 if (0 >= rc_file_exists(sandbox_info.sandbox_lib)) { 493 if (!rc_file_exists(sandbox_info.sandbox_lib)) {
494 perror("sandbox: Could not open the sandbox library"); 494 perror("sandbox: Could not open the sandbox library");
495 exit(EXIT_FAILURE); 495 exit(EXIT_FAILURE);
496 } 496 }
497#endif 497#endif
498 if (0 >= rc_file_exists(sandbox_info.sandbox_rc)) { 498 if (!rc_file_exists(sandbox_info.sandbox_rc)) {
499 perror("sandbox: Could not open the sandbox rc file"); 499 perror("sandbox: Could not open the sandbox rc file");
500 exit(EXIT_FAILURE); 500 exit(EXIT_FAILURE);
501 } 501 }
502 502
503 /* set up the required environment variables */ 503 /* set up the required environment variables */
586 if (print_debug) { 586 if (print_debug) {
587 printf("========================== Gentoo linux path sandbox ===========================\n"); 587 printf("========================== Gentoo linux path sandbox ===========================\n");
588 printf("The protected environment has been shut down.\n"); 588 printf("The protected environment has been shut down.\n");
589 } 589 }
590 590
591 if (1 == rc_file_exists(sandbox_info.sandbox_log)) { 591 if (rc_file_exists(sandbox_info.sandbox_log)) {
592 sandbox_log_presence = 1; 592 sandbox_log_presence = 1;
593 print_sandbox_log(sandbox_info.sandbox_log); 593 print_sandbox_log(sandbox_info.sandbox_log);
594 } else if (print_debug) { 594 } else if (print_debug) {
595 printf("--------------------------------------------------------------------------------\n"); 595 printf("--------------------------------------------------------------------------------\n");
596 } 596 }

Legend:
Removed from v.280  
changed lines
  Added in v.282

  ViewVC Help
Powered by ViewVC 1.1.20