[Bug 259625] fdescfs: file descriptors with O_EXEC give EACCESS when opened

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 03 Nov 2021 11:29:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259625

--- Comment #7 from Konstantin Belousov <kib@FreeBSD.org> ---
(In reply to Konstantin Belousov from comment #5)
I remembered that there is a trick in POSIX that de-facto allowed O_RDONLY be
zero.
But apparently it is even more strict, making your second program
non-conforming.

Applications shall specify exactly one of the first five values (file access
modes) below in the value of oflag:
O_EXEC Open for execute only (non-directory files). The result is unspecified
if
this flag is applied to a directory.
O_RDONLY Open for reading only.
O_RDWR Open for reading and writing. The result is undefined if this flag is
applied to a FIFO.
O_SEARCH Open directory for search only. The result is unspecified if this flag
is
applied to a non-directory file.
O_WRONLY Open for writing only.

I.e. O_RDONLY|O_EXEC is illegal from POSIX PoV, and FreeBSD interprets it as
O_EXEC.

-- 
You are receiving this mail because:
You are the assignee for the bug.