The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2bd157bc732a1939cb71314e48de6118b91e0ad0

commit 2bd157bc732a1939cb71314e48de6118b91e0ad0
Author:     Dag-Erling Smørgrav <d...@freebsd.org>
AuthorDate: 2025-08-01 23:11:31 +0000
Commit:     Dag-Erling Smørgrav <d...@freebsd.org>
CommitDate: 2025-08-01 23:11:56 +0000

    libc: Deprecate readdir_r()
    
    This function was never safe to use.  We marked it deprecated in the
    manual page in 2016, and it is marked obsolete in POSIX 2024.  Add a
    linker warning and annotate the prototype.
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    imp, markj
    Differential Revision:  https://reviews.freebsd.org/D51681
---
 include/dirent.h       | 3 ++-
 lib/libc/gen/readdir.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/dirent.h b/include/dirent.h
index dff0e8675722..7fcdceb10b23 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -116,7 +116,8 @@ DIR *fdopendir(int);
 struct dirent *
         readdir(DIR *);
 #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
-int     readdir_r(DIR *, struct dirent *, struct dirent **);
+int     readdir_r(DIR *, struct dirent *, struct dirent **)
+       __deprecated1("Does not take variable {NAME_MAX} into account");
 #endif
 void    rewinddir(DIR *);
 #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c
index b70102954df1..94d2b2e8d877 100644
--- a/lib/libc/gen/readdir.c
+++ b/lib/libc/gen/readdir.c
@@ -134,3 +134,5 @@ __readdir_r(DIR *dirp, struct dirent *entry, struct dirent 
**result)
 }
 
 __strong_reference(__readdir_r, readdir_r);
+__warn_references(readdir_r,
+    "warning: this program uses readdir_r(), which is unsafe.");

Reply via email to