/[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 372 Revision 373
851 abort(); 851 abort();
852} 852}
853 853
854int is_sandbox_on() 854int is_sandbox_on()
855{ 855{
856 int old_errno = errno; 856 int result;
857 save_errno();
857 858
858 /* $SANDBOX_ACTIVE is an env variable that should ONLY 859 /* $SANDBOX_ACTIVE is an env variable that should ONLY
859 * be used internal by sandbox.c and libsanbox.c. External 860 * be used internal by sandbox.c and libsanbox.c. External
860 * sources should NEVER set it, else the sandbox is enabled 861 * sources should NEVER set it, else the sandbox is enabled
861 * in some cases when run in parallel with another sandbox, 862 * in some cases when run in parallel with another sandbox,
865 */ 866 */
866 if ((is_env_on(ENV_SANDBOX_ON)) && 867 if ((is_env_on(ENV_SANDBOX_ON)) &&
867 (1 == sandbox_on) && 868 (1 == sandbox_on) &&
868 (NULL != getenv(ENV_SANDBOX_ACTIVE)) && 869 (NULL != getenv(ENV_SANDBOX_ACTIVE)) &&
869 (0 == strncmp(getenv(ENV_SANDBOX_ACTIVE), SANDBOX_ACTIVE, 13))) { 870 (0 == strncmp(getenv(ENV_SANDBOX_ACTIVE), SANDBOX_ACTIVE, 13))) {
870 errno = old_errno; 871 result = 1;
871 return 1;
872 } else { 872 } else
873 errno = old_errno; 873 result = 0;
874 return 0; 874 restore_errno();
875 } 875 return result;
876} 876}
877 877
878int before_syscall(const char *func, const char *file) 878int before_syscall(const char *func, const char *file)
879{ 879{
880 int old_errno = errno; 880 int old_errno = errno;

Legend:
Removed from v.372  
changed lines
  Added in v.373

  ViewVC Help
Powered by ViewVC 1.1.20