Date: Mon, 04 Jun 2001 21:49:07 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Martin Str|mberg Message-Id: <2593-Mon04Jun2001214907+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <200106041203.OAA11068@mother.ludd.luth.se> (message from Martin Str|mberg on Mon, 4 Jun 2001 14:03:56 +0200 (MEST)) Subject: Re: file append problem References: <200106041203 DOT OAA11068 AT mother DOT ludd DOT luth DOT se> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Martin Str|mberg > Date: Mon, 4 Jun 2001 14:03:56 +0200 (MEST) > > According to Mark E.: > > I see two solutions: > > 1) Have _flsbuf (and other places where _IOAPPEND is checked) check whether > > the underlying fd has its append flag set before calling _write. > > 2) Add logic to _write to check whether a file descriptor's append flag is > > set and take action. > > Perhaps there's a third. In dup2 make sure the append flags are in sync? If I understand correctly the analysis Mark presented, the problem is that we have two flags, where we should have had one. Since we now have a way to store attributes for handles, we should dump the _IOAPPEND flag in the FILE object and instead use the append flag of the underlying file handle when it is written to. Having two flags for the same functionality just looks for trouble, IMHO.