From: ian AT cygnus DOT com (Ian Lance Taylor) Subject: Re: The alleged newlib/libc/stdio/fdopen.c bug 18 Feb 1998 22:01:35 -0800 Message-ID: <199802190409.XAA13356.cygnus.cygwin32.developers@subrogation.cygnus.com> References: <199802190107 DOT RAA09492 AT skaro DOT cygnus DOT com> To: noer AT cygnus DOT com Cc: cygwin32-developers AT cygnus DOT com From: Geoffrey Noer Date: Wed, 18 Feb 1998 17:07:54 -0800 (PST) Sergey Okhapkin wrote: > > Geoffrey Noer wrote: > > Ian suggests the following: > > > > if ((oflags & O_APPEND) > > #ifdef F_GETFL > > && !(fdflags & O_APPEND) > > #endif > > ) > > fp->_flags |= __SAPP; > > > > Look right? > > I'm not sure. When O_APPEND is set, we have to seek to end of file on > fdopen() call. When __SAPP is set, _every_ write call seeks to eof before > write! Is it a correct behavior for O_APPEND? BTW, where fdflags variable > is defined? That is correct for O_APPEND: every write should go to the end of the file, wherever the end of the file happens to be at that time. For example, on Unix this can be used for writing log files from several processes; provided each write is done in a single call, if you use O_APPEND then you know that none of the writes will clobber another. The patch looks OK to me. Ian