Open with O_APPEND fails

Mel fbsd.questions at
Sun Dec 28 04:10:45 UTC 2008

On Saturday 27 December 2008 18:16:41 Mitar wrote:
> Hi!
> On Sun, Dec 28, 2008 at 1:17 AM, Mel
> <fbsd.questions at> wrote:
> >    15          fd = open(fname, O_WRONLY|O_APPEND);
> Try only with O_APPEND, without O_WRONLY.

Why would you?
open(2) will succeed but write(2) will fail with EBADF as documented (and I 
verified this behavior). Still no EACCES as you and the bugreporter are 

If this is really a bug in FreeBSD I'd expect way more applications to suffer 
issues. There must be something else at play and I certainly don't have an 
explanation why specifying the O_WRONLY flag would cause this bug to 

I suspect priv(9) to be responsible for the change in behavior you're seeing, 
however that should return EPERM not EACCES.

Problem with today's modular software: they start with the modules
    and never get to the software part.

More information about the freebsd-questions mailing list