Skip to content

Commit bd875f1

Browse files
committed
[llvm][clang] Sandbox IO operations (access)
1 parent 549920b commit bd875f1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/lib/Support/IOSandboxInternal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static constexpr auto read = detail::interpose(::read);
4848
static constexpr auto pread = detail::interpose(::pread);
4949
static constexpr auto mmap = detail::interpose(::mmap);
5050
static constexpr auto readdir = detail::interpose(::readdir);
51+
static constexpr auto access = detail::interpose(::access);
5152
static constexpr auto stat = detail::interpose(::stat);
5253
static constexpr auto lstat = detail::interpose(::lstat);
5354
static constexpr auto fstat = detail::interpose(::fstat);

llvm/lib/Support/Unix/Path.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ std::error_code access(const Twine &Path, AccessMode Mode) {
623623
SmallString<128> PathStorage;
624624
StringRef P = Path.toNullTerminatedStringRef(PathStorage);
625625

626-
if (::access(P.begin(), convertAccessMode(Mode)) == -1)
626+
if (llvm::access(P.begin(), convertAccessMode(Mode)) == -1)
627627
return errnoAsErrorCode();
628628

629629
if (Mode == AccessMode::Execute) {
@@ -978,7 +978,7 @@ ErrorOr<basic_file_status> directory_entry::status() const {
978978
static bool hasProcSelfFD() {
979979
// If we have a /proc filesystem mounted, we can quickly establish the
980980
// real name of the file with readlink
981-
static const bool Result = (access("/proc/self/fd", R_OK) == 0);
981+
static const bool Result = (llvm::access("/proc/self/fd", R_OK) == 0);
982982
return Result;
983983
}
984984
#endif

0 commit comments

Comments
 (0)