Rainer Weikusat <
rweikusat@talktalk.net> writes:
By experiment, I've just determined that it's possible to create a file
with O_CREAT | O_RDWR and with permissions set to 0, which can be
written to using the returned file descriptor, at least on Linux. Is
this supposed to be a feature that's documented or standardized
somewhere?
https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
open() or openat() fails and sets errno to EACCESS if:
Search permission is denied on a component of the path prefix, or
the file exists and the permissions specified by oflag are denied,
or the file does not exist and write permission is denied for the
parent directory of the file to be created, or O_TRUNC is specified
and write permission is denied.
None of those apply to your case.
Less formally, I think the behavior makes sense. Permissions are
checked by open() when you open an existing file, not when a new
file is created (other than permissions on any parent directories).
--
Keith Thompson (The_Other_Keith)
Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)