commit 7c8dc59f8a5d35b5490893665ad8957c8c61e7e9
parent a8d004bdfc29e49420d42fd873669e2f53a3e9ec
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 24 Feb 2021 10:47:43 -0500
rt: add note about (f)access(at)
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha
@@ -116,6 +116,9 @@ export fn lseek(fd: int, off: i64, whence: uint) (i64 | errno) = {
fd: u64, off: u64, whence: u64))?: i64;
};
+// The use of this function is discouraged, as it can create race conditions.
+// TOCTOU is preferred: attempt to simply use the resource you need and handle
+// any access errors which occur.
export fn faccessat(
dirfd: int,
path: *const char,
@@ -135,6 +138,9 @@ export fn faccessat(
};
};
+// The use of this function is discouraged, as it can create race conditions.
+// TOCTOU is preferred: attempt to simply use the resource you need and handle
+// any access errors which occur.
export fn access(path: *const char, mode: int) (bool | errno) =
faccessat(AT_FDCWD, path, mode, 0);