Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

I discovered that open syscall with only O_APPEND fails with
permission denied if an user does not have rights to write to a file
(what is normal) even if it is root (what is a surprise). For example,
if I have a file owned by www:www and with 644 permissions root cannot
do open(testfile, O_APPEND) call. If I change ownership of I change
permission to for example 666, call succeedes.

This works on Linux (Debian). So this is a feature? Or a bug?

(I discovered that because htpasswd failed to add new
username/password pair (ran as root) to a file owner by www.)

Checked on FreeBSD 7.0-STABLE.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

On Sun, Dec 28, 2008 at 1:17 AM, Mel
fbsd.questi...@rachie.is-a-geek.net wrote:
15  fd = open(fname, O_WRONLY|O_APPEND);

Try only with O_APPEND, without O_WRONLY.

I have just found a bug report about that:

https://issues.apache.org/bugzilla/show_bug.cgi?id=45923

But the question remains: why this fails? It works on Linux, as it is
seen from bug report it works also on FreeBSD 6.x, why it does not
work anymore on FreeBSD 7.x? Is it correct that it does not work? I
have not found anywhere written that O_WRONLY should be specified with
O_APPEND.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

On Sun, Dec 28, 2008 at 4:58 AM, Gary Kline kl...@thought.org wrote:
 Just a thought, but have you figured out what the value of
 that OR is? then check the 6.x and 7.x src.

You mean O_RDONLY? Is not that 0? So that O_RDONLY | O_APPEND is the
same as O_APPEND? (That is why I am writing about O_APPEND flag and
not O_RDONLY | O_APPEND as that bug report.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Open with O_APPEND fails

2008-12-27 Thread Mitar
Hi!

On Sun, Dec 28, 2008 at 5:10 AM, Mel
fbsd.questi...@rachie.is-a-geek.net wrote:
 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
 seeing.

Where is documented that write would fail if file is opened only with
O_APPEND? Just O_APPEND should also open file for writing as appending
is also writing. It cannot be used without write semantics so file
has to be open also for writing.


Mitar
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org