aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPat Tullmann <pat.github@tullmann.org>2025-02-18 17:18:03 -0800
committerAlex Rønne Petersen <alex@alexrp.com>2025-03-24 16:20:45 +0100
commit14c046fc0728070c575c0e849b7be649cbb2b9a0 (patch)
tree0cd70f8ed2bd9d549609c289c3e62b93dff25dd2 /src
parent02373eb2a59f4a16a06460c244958e236b1c5291 (diff)
downloadzig-14c046fc0728070c575c0e849b7be649cbb2b9a0.tar.gz
zig-14c046fc0728070c575c0e849b7be649cbb2b9a0.zip
lib/std: PermissionDenied/AccessDenied cleanup and fallout
This PR consistently maps .ACCES into AccessDenied and .PERM into PermissionDenied. AccessDenied is returned if the file mode bit (user/group/other rwx bits) disallow access (errno was `EACCES`). PermissionDenied is returned if something else denies access (errno was `EPERM`) (immutable bit, SELinux, capabilities, etc). This somewhat subtle distinction is a POSIX thing. Most of the change is updating std.posix Error Sets to contain both errors, and then propagating the pair up through caller Error Sets. Fixes #16782
Diffstat (limited to 'src')
-rw-r--r--src/DarwinPosixSpawn.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/DarwinPosixSpawn.zig b/src/DarwinPosixSpawn.zig
index aaf2df6ec3..0743eb0c66 100644
--- a/src/DarwinPosixSpawn.zig
+++ b/src/DarwinPosixSpawn.zig
@@ -6,6 +6,7 @@ pub const Error = error{
InvalidFileDescriptor,
NameTooLong,
TooBig,
+ AccessDenied,
PermissionDenied,
InputOutput,
FileSystem,
@@ -188,7 +189,7 @@ pub fn spawnZ(
.@"2BIG" => return error.TooBig,
.NOMEM => return error.SystemResources,
.BADF => return error.InvalidFileDescriptor,
- .ACCES => return error.PermissionDenied,
+ .ACCES => return error.AccessDenied,
.IO => return error.InputOutput,
.LOOP => return error.FileSystem,
.NAMETOOLONG => return error.NameTooLong,