Skip to content

Commit ff9c775

Browse files
committed
directory(3): caveats for seekdir.
- If the directory being read is altered, past telldir results are (potentially) invalidated. Don't promise that they'll work. - There is no way to detect failure. (It returns void, and while it may set errno, the main failure path in the actual implementation does not, so even setting errno to 0 beforehand doesn't work.) Fix a typo elsewhere while passing through. Bump date.
1 parent 89ba0d7 commit ff9c775

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

lib/libc/gen/directory.3

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $NetBSD: directory.3,v 1.43 2021/02/17 23:51:04 dholland Exp $
1+
.\" $NetBSD: directory.3,v 1.44 2026/01/22 04:01:14 dholland Exp $
22
.\"
33
.\" Copyright (c) 1983, 1991, 1993
44
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
2929
.\"
3030
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
3131
.\"
32-
.Dd February 17, 2021
32+
.Dd January 21, 2026
3333
.Dt DIRECTORY 3
3434
.Os
3535
.Sh NAME
@@ -216,6 +216,13 @@ from which they are derived.
216216
If the directory is closed and then reopened, the
217217
.Fn telldir
218218
value cannot be re-used.
219+
If the directory is altered from the same or another process, the
220+
.Fn telldir
221+
value becomes invalid.
222+
.Pp
223+
.Fn seekdir
224+
returns no value.
225+
There is no supported way to detect if the operation succeeded.
219226
.It Fn rewinddir "dirp"
220227
The
221228
.Fn rewinddir
@@ -321,7 +328,7 @@ When a file descriptor is used to implement the directory stream, the
321328
.Fn closedir
322329
function behaves as if the
323330
.Dv FD_CLOEXEC
324-
had been set for the file descriptor.
331+
flag had been set for the file descriptor.
325332
In other words, it is mandatory that
326333
.Fn closedir
327334
deallocates the file descriptor.

0 commit comments

Comments
 (0)