access.2, chmod.2, chown.2, execveat.2, futimesat.2, link.2, mkdir.2, mknod.2, mount_setattr.2, open.2, open_by_handle_at.2, readlink.2, rename.2, stat.2, statx.2, symlink.2, unlink.2, utimensat.2, mkfifo.3, scandir.3: Fix EBADF error description

Make the description of the EBADF error for invalid 'dirfd' more
uniform. In particular, note that the error only occurs when the
pathname is relative, and that it occurs when the 'dirfd' is
neither valid *nor* has the value AT_FDCWD.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-08-12 04:05:59 +02:00
parent 38a350061e
commit 9f4e736ad0
20 changed files with 96 additions and 25 deletions

View File

@ -278,8 +278,12 @@ The following additional errors can occur for
.BR faccessat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in

View File

@ -309,8 +309,12 @@ The following additional errors can occur for
.BR fchmodat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in

View File

@ -293,8 +293,12 @@ The following additional errors can occur for
.BR fchownat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in

View File

@ -121,9 +121,12 @@ can also occur for
The following additional errors can occur for
.BR execveat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in

View File

@ -99,8 +99,12 @@ The following additional errors can occur for
.BR futimesat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -282,10 +282,14 @@ The following additional errors can occur for
.BR linkat ():
.TP
.B EBADF
.I oldpath
.RI ( newpath )
is relative but
.I olddirfd
or
.I newdirfd
is not a valid file descriptor.
.RI ( newdirfd )
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
An invalid flag value was specified in

View File

@ -192,8 +192,12 @@ The following additional errors can occur for
.BR mkdirat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -229,8 +229,12 @@ The following additional errors can occur for
.BR mknodat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -408,8 +408,12 @@ is set to indicate the cause of the error.
.SH ERRORS
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EBADF
.I userns_fd

View File

@ -1290,8 +1290,12 @@ The following additional errors can occur for
.BR openat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -349,9 +349,11 @@ is not an open file descriptor.
.TP
.B EBADF
.I pathname
is relative and
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EFAULT
.IR handle

View File

@ -200,8 +200,12 @@ The following additional errors can occur for
.BR readlinkat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -438,9 +438,11 @@ and
.BR renameat2 ():
.TP
.B EBADF
.I oldpath
.RI ( newpath )
is relative but
.I olddirfd
or
.I newdirfd
.RI ( newdirfd )
is not a valid file descriptor.
.TP
.B ENOTDIR

View File

@ -434,8 +434,12 @@ The following additional errors can occur for
.BR fstatat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in

View File

@ -505,8 +505,12 @@ in the path prefix of
.BR path_resolution (7).)
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid open file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EFAULT
.I pathname

View File

@ -203,8 +203,12 @@ The following additional errors can occur for
.BR symlinkat ():
.TP
.B EBADF
.I linkpath
is relative but
.I newdirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOENT
.I linkpath

View File

@ -246,8 +246,12 @@ The following additional errors can occur for
.BR unlinkat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
An invalid flag value was specified in

View File

@ -269,7 +269,7 @@ is not a valid file descriptor.
.B EBADF
.RB ( utimensat ())
.I pathname
is a relative pathname, but
is relative but
.I dirfd
is neither
.BR AT_FDCWD

View File

@ -162,8 +162,12 @@ The following additional errors can occur for
.BR mkfifoat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -204,8 +204,12 @@ The following additional errors can occur for
.BR scandirat ():
.TP
.B EBADF
.I dirp
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I dirp