open.2: Explicitly describe the EBADF error that can occur with openat()

In particular, specifying an invalid file descriptor number
in 'dirfd' can be used as a check that 'pathname' is absolute.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-08-12 03:11:13 +02:00
parent a9db6c1ba3
commit 73434f4003
1 changed files with 13 additions and 0 deletions

View File

@ -966,6 +966,19 @@ must be a directory that was opened for reading
or using the
.B O_PATH
flag.
.PP
If the pathname given in
.I pathname
is relative, and
.I dirfd
is not a valid file descriptor, an error
.RB ( EBADF )
results.
(Specifying an invalid file descriptor number in
.I dirfd
can be used as a means to ensure that
.I pathname
is absolute.)
.\"
.SS openat2(2)
The