Ignore:
Timestamp:
Nov 30, 2013, 12:05:22 AM (7 years ago)
Author:
cal@…
Message:

darwintrace: Don't always follow symlinks

Only follow symlinks in darwintrace_is_in_sandbox() when the DT_FOLLOWSYMS
flag is set. This has the following advantages:

  • lstat(2) and readlink(2) work on symlinks that point to files outside of the sandbox (previously, these attempts would have returned ENOENT).
  • readdir(3) is a lot faster again, because it doesn't have to lstat(2) and possibly readlink(2) every file in a loop.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwintracelib1.0/rename.c

    r113026 r114131  
    5353        int result = 0;
    5454
    55         if (!__darwintrace_is_in_sandbox(from, DT_REPORT)) {
     55        if (!__darwintrace_is_in_sandbox(from, DT_REPORT | DT_FOLLOWSYMS)) {
    5656                errno = ENOENT;
    5757                result = -1;
    58         } else if (!__darwintrace_is_in_sandbox(to, DT_REPORT)) {
     58        } else if (!__darwintrace_is_in_sandbox(to, DT_REPORT | DT_FOLLOWSYMS)) {
    5959                errno = EACCES;
    6060                result = -1;
Note: See TracChangeset for help on using the changeset viewer.