-.\" $OpenBSD: opendir.3,v 1.2 2022/09/11 06:38:10 jmc Exp $
+.\" $OpenBSD: opendir.3,v 1.3 2024/03/23 16:30:01 guenther Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: September 11 2022 $
+.Dd $Mdocdate: March 23 2024 $
.Dt OPENDIR 3
.Os
.Sh NAME
.Pp
The
.Fn readdir_r
-function (much like
-.Fn readdir )
-initializes the
+function is a deprecated variant of
+.Fn readdir .
+Like
+.Fn readdir ,
+it initializes the
.Vt dirent
structure referenced by
.Fa entry
.Fn fdopendir
function appeared in
.Ox 5.0 .
+.Sh CAVEATS
+The
+.Fn readdir_r
+function was intended to provide a thread-safe version of
+.Fn readdir .
+However, it was later found to be both unnecessary in the typical
+usage and unportable due to insufficient buffer sizing guidance.
+It was therefore officially deprecated in issue 8.
*
* S/Key verification check, lookups, and authentication.
*
- * $OpenBSD: skeylogin.c,v 1.64 2023/03/15 17:01:35 millert Exp $
+ * $OpenBSD: skeylogin.c,v 1.65 2024/03/23 16:30:01 guenther Exp $
*/
#ifdef QUOTA
int
skeygetnext(struct skey *mp)
{
- struct dirent entry, *dp;
+ struct dirent *dp;
int rval;
if (mp->keyfile != NULL) {
return (-1);
rval = 1;
- while ((readdir_r(mp->keydir, &entry, &dp)) == 0 && dp == &entry) {
+ while ((dp = readdir(mp->keydir)) != NULL) {
/* Skip dot files and zero-length files. */
- if (entry.d_name[0] != '.' &&
- (rval = skeygetent(-1, mp, entry.d_name)) != 1)
+ if (dp->d_name[0] != '.' &&
+ (rval = skeygetent(-1, mp, dp->d_name)) != 1)
break;
}