From 73434f4003c47b5097b195a26a8dbc0d4450a78c Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 12 Aug 2021 03:11:13 +0200 Subject: [PATCH] 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 --- man2/open.2 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/man2/open.2 b/man2/open.2 index 711fd96b8..bfc1b2f6b 100644 --- a/man2/open.2 +++ b/man2/open.2 @@ -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