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

Diff of /trunk/libsandbox/libsandbox.c

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

Revision 330 Revision 331
1018 1018
1019 if (0 == result) { 1019 if (0 == result) {
1020 if ((NULL != getenv(ENV_SANDBOX_PID)) && (is_env_on(ENV_SANDBOX_ABORT))) 1020 if ((NULL != getenv(ENV_SANDBOX_PID)) && (is_env_on(ENV_SANDBOX_ABORT)))
1021 kill(atoi(getenv(ENV_SANDBOX_PID)), SIGUSR1); 1021 kill(atoi(getenv(ENV_SANDBOX_PID)), SIGUSR1);
1022 1022
1023 /* FIXME: Should probably audit errno, and enable some other
1024 * error to be returned (EINVAL for invalid mode for
1025 * fopen() and co, ETOOLONG, etc). */
1023 errno = EACCES; 1026 errno = EACCES;
1024 } 1027 }
1025 1028
1026 return result; 1029 return result;
1027} 1030}
1044 } 1047 }
1045} 1048}
1046 1049
1047int before_syscall_open_char(const char *func, const char *file, const char *mode) 1050int before_syscall_open_char(const char *func, const char *file, const char *mode)
1048{ 1051{
1052 if (NULL == mode)
1053 return 0;
1054
1049 if (*mode == 'r' && (0 == (strcmp(mode, "r")) || 1055 if ((*mode == 'r') && ((0 == (strcmp(mode, "r"))) ||
1050 /* The strspn accept args are known non-writable modifiers */ 1056 /* The strspn accept args are known non-writable modifiers */
1051 (strlen(++mode) == strspn(mode, "xbtmc")))) { 1057 (strlen(++mode) == strspn(mode, "xbtmc")))) {
1052 return before_syscall("open_rd", file); 1058 return before_syscall("open_rd", file);
1053 } else { 1059 } else {
1054 return before_syscall("open_wr", file); 1060 return before_syscall("open_wr", file);
1055 } 1061 }
1056} 1062}

Legend:
Removed from v.330  
changed lines
  Added in v.331

  ViewVC Help
Powered by ViewVC 1.1.20