On Wed, 13 Dec 2006, Pawel Jakub Dawidek wrote:

pjd         2006-12-13 09:58:49 UTC

 FreeBSD src repository

 Modified files:
   lib/libc/sys         mkfifo.2
 Log:
 mkfifo(2) returns EACCES when write permission is denied for a component of
 the path prefix.

It isn't that broken.  Write permission is only required for the _final_
component of the path prefix (after pathname resolution).  open.2
expresses this as follows:

%%%
.It Bq Er EACCES
.Dv O_CREAT
is specified,
the file does not exist,
and the directory in which it is to be created
does not permit writing.
%%%

For mkfifo, O_CREAT is implicit, and if the file already exists then
mkfifo() cannot create it, unlike for open(), but as for open() the
writability of the parent directory is irrelevant -- mkfio() returns
EEXISTS in this case.

Old draft POSIX says for mkfifo():

%%%
24874            [EACCES]            A component of the path prefix denies 
search permission, or write permission
24875                                is denied on the parent directory of the 
FIFO to be created.
%%%

This is better wording than all the above.  It seems to allow either EEXIST
or EACCES when the the file already exists and the parent directory is not
writable, but I think EACCES for this case doesn't happen in FreeBSD and
would be a bug if it did.

Old draft POSIX says for open():

%%%
27394            [EACCES]            Search permission is denied on a component 
of the path prefix, or the file
27395                                exists and the permissions specified by 
oflag are denied, or the file does not
27396                                exist and write permission is denied for 
the parent directory of the file to be
27397                                created, or O_TRUNC is specified and write 
permission is denied.
%%%

This is essentially the same as open.2 except it isn't missing documentation
of errors for O_TRUNC.  Here it is clear that writability of the parent
directory is irrelevant if the file already exists.  This is a very
important point for open with (O_CREAT | O_TRUNC).

Here
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to