Mail Archives: djgpp-workers/1999/12/13/05:47:28
> Date: Sun, 12 Dec 1999 13:36:02 +0100
> From: pullmoll AT t-online DOT de (Juergen Buchmueller)
> X-Accept-Language: en
> To: dj AT delorie DOT com
Thanks for your report.
> I stumbled across a flaw in DJGPPs implementation of the fopen() libc
> function - specificially the "a" append mode.
It's a known bug: the library currently handles "a" and O_APPEND only
when the file is opened, but it doesn't ``remember'' that information
afterwards.
(Frankly, I'm amazed that it took so long for someone to complain.
AFAIK, this bug exists since DJGPP v2.0 hit the streets; I found out
about it by chance, simply from examining the sources, about half a
year ago.)
> I hope it'll be easy to fix it.
Unfortunately, it isn't. DOS doesn't have an ``append'' bit in any of
the functions that open/create files. So this requires to save the
O_APPEND bit in some internal library data structure and use some
non-trivial logic based on that bit to reset the file position before
each write.
Unless some disaster strikes, this should be fixed in v2.04.
- Raw text -