git: 8766ae10d3b7 - releng/14.1 - access.2: Mention that lstat(2) should be used for symbolic links

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 23 May 2024 02:47:14 UTC
The branch releng/14.1 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=8766ae10d3b792caf7c31b583afcaf43b1a6543f

commit 8766ae10d3b792caf7c31b583afcaf43b1a6543f
Author:     Gordon Bergling <gbe@FreeBSD.org>
AuthorDate: 2024-05-13 08:40:12 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-05-23 02:45:49 +0000

    access.2: Mention that lstat(2) should be used for symbolic links
    
    access(), eaccess() and faccessat() will always dereference
    symbolic links.
    
    So add a note in the manual page, that lstat(2) should be
    used in the case of symbolic links.
    
    PR:     262895
    Reviewed by:    gbe, pauamma_gundo.com
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D44890
    
    (cherry picked from commit 421025a274fb5759b3ecc8bdb30b24db830b45ae)
    (cherry picked from commit f075b6113726d74342d4af15dfab60709f50b859)
    
    Approved by:    re (cperciva)
---
 lib/libc/sys/access.2 | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/libc/sys/access.2 b/lib/libc/sys/access.2
index 681e4483a9e6..64ed1133b23d 100644
--- a/lib/libc/sys/access.2
+++ b/lib/libc/sys/access.2
@@ -27,7 +27,7 @@
 .\"
 .\"     @(#)access.2	8.2 (Berkeley) 4/1/94
 .\"
-.Dd March 30, 2021
+.Dd May 13, 2024
 .Dt ACCESS 2
 .Os
 .Sh NAME
@@ -149,6 +149,15 @@ Likewise for
 .Dv R_OK
 and
 .Dv W_OK .
+.Pp
+.Fn access ,
+.Fn eaccess
+and
+.Fn faccessat
+will always dereference symbolic links.
+If the symbolic link itself needs to be referenced,
+.Xr lstat 2
+should be used instead.
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS