[RFC] fdopen("a"), O_APPEND and active handles

Siddhesh Poyarekar siddhesh@redhat.com
Wed Feb 19 10:41:00 GMT 2014


Hi,

So while thinking over the third iteration of this fix, it occurred to
be that even the act of adding O_APPEND to a file descriptor through
fdopen will change the way subsequent write() calls behave, since they
will suddenly start appending to the file instead of writing at the
current location.  Given the fact that a handle's effect should not
come into effect till it performs its first offset modifying act
(i.e. fseek, read, write, etc.), this behaviour seems to be in
violation of that expectation.

This would mean that an fdopen should not directly result in a call to
O_APPEND.  Instead, it should record the result of the open somewhere
and on first read/write/seek, call fcntl and then perform that action.
Is this interpretation correct or is there something else in the
standard that allows fdopen to set O_APPEND right away?  I know that
the fdopen specification rationale says that a good specification sets
O_APPEND, but it doesn't really specify when.

Siddhesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140219/c4bbf6d6/attachment.sig>


More information about the Libc-alpha mailing list