# posix: access/accessZ/faccessat/faccessatZ can return AccessDenied or PermissionDenied · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/8d9bb9746165abf067851f490cfea8c49fbd59ea)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 8d9bb9746165abf067851f490cfea8c49fbd59ea

Requested commit: 8d9bb9746165abf067851f490cfea8c49fbd59ea

Commit: 8d9bb9746165abf067851f490cfea8c49fbd59ea

Tree: 44fb283773dcc88f532ead40be9ac20cf9c242d5

Author: Pat Tullmann

Committer: Alex Rønne Petersen

## Message

```
posix: access/accessZ/faccessat/faccessatZ can return AccessDenied or PermissionDenied

`EACCES` is returned if the file mode bit (i.e., user/group/other rwx
bits) disallow access.  `EPERM` is returned if something else denies
access (immutable bit, SELinux, capabilities, etc).  This somewhat subtle
no-access distinction is part of POSIX.  For now map both to
`error.PermissionDenied` to keep the error signature unchanged.  See
duopoly.

This PR is effecitvely an update/simplification of PR #19193.

Tested locally with an immutable file.

Fixes #22733 and #19162.

```

## Parents

- [a8d3760c5bc31ed114516c89f31d9107b803a6b7](https://git.cafe/gitcafe/zig/commit/a8d3760c5bc31ed114516c89f31d9107b803a6b7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/8d9bb9746165abf067851f490cfea8c49fbd59ea?format=markdown)
