This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: fopen() with 'w+' does not set O_CREAT
- From: Kelvin Lawson <klawson at ad-holdings dot co dot uk>
- To: ecos-discuss at sources dot redhat dot com
- Date: Mon, 29 Mar 2004 11:06:10 +0100
- Subject: [ECOS] Re: fopen() with 'w+' does not set O_CREAT
- References: <c3scg5$56a$1@sea.gmane.org> <20040327175421.GE1515@lunn.ch>
Hi Andrew,
Thanks for the response. I've sent a proposed fix to the patch list:
http://ecos.sourceware.org/ml/ecos-patches/2004-03/msg00069.html
Cheers,
Kelvin.
Andrew Lunn wrote:
On Wed, Mar 24, 2004 at 04:18:37PM +0000, Kelvin Lawson wrote:
Hi All,
I believe the mode settings have been implemented incorrectly for
fopen(). If a file is opened 'w+', it should have O_CREAT set:
w+ Open for reading and writing. The file is created
if it does not exist, otherwise it is truncated.
The stream is positioned at the beginning of the
file.
However fopen() only sets O_RDWR, without O_CREAT. This is because w+ is
translated to CYG_STREAM_READWRITE by process_mode(), which is
translated to O_RDWR by cyg_stdio_open().
This was mentioned on the list a while ago but didn't seem to have any
response:
http://sources.redhat.com/ml/ecos-discuss/2002-11/msg00333.html
Have I missed something here ? If not I'll send a patch.
Please send a patch.
Thanks
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss