This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 719abf29a43 libs/libc/unistd: Set errno when access() denies W_OK.
719abf29a43 is described below
commit 719abf29a43f1e0fc5c1a08fbadc38e0454aed00
Author: Marco Casaroli <[email protected]>
AuthorDate: Sat Oct 17 19:59:13 2026 +0200
libs/libc/unistd: Set errno when access() denies W_OK.
access() returned -1 for W_OK on a file without a write bit, but it
did not set errno. The caller then saw an old errno value.
access() now sets errno to EACCES in this case, as POSIX requires.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
libs/libc/unistd/lib_access.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libs/libc/unistd/lib_access.c b/libs/libc/unistd/lib_access.c
index cbfee37eef9..d3ca1f17178 100644
--- a/libs/libc/unistd/lib_access.c
+++ b/libs/libc/unistd/lib_access.c
@@ -99,6 +99,7 @@ int access(FAR const char *path, int amode)
return 0;
}
+ set_errno(EACCES);
return -1;
}