fopen with "a+" does not respect setting file read position to start of file

Eric Blake eblake@redhat.com
Thu Apr 1 16:35:00 GMT 2010


On 04/01/2010 05:53 AM, Matthias Andree wrote:
>> Well if that worked previously it was a bug.
> 
> Not a Cygwin defect, but an application bug, and what Gavin named "work
> around" is actually the right fix.
> 
> POSIX explicitly states that the initial position beginning/end of file
> in append mode is implementation-defined, and the Cygwin documentation
> doesn't make promises either way. Linux and FreeBSD document BOF and
> EOF, respectively.

I agree that it is not a cygwin bug.  And I actually prefer Linux'
interpretation of BOF, since it matches with the POSIX requirement that
open(,O_APPEND|O_RDWR) be positioned at offset 0 and not at the end (it
is only fopen that is allowed, but not required, to be at the end).  In
fact, the release of m4 1.4.10 worked on cygwin and Linux but was broken
on BSD because of this very portability pitfall.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100401/d02c8763/attachment.sig>


More information about the Cygwin mailing list