Date: Tue, 30 Jan 2001 17:14:00 -0500 Message-Id: <200101302214.RAA24294@envy.delorie.com> X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f From: DJ Delorie To: djgpp-workers AT delorie DOT com In-reply-to: <200101302125.WAA29699@father.ludd.luth.se> (message from Martin Str|mberg on Tue, 30 Jan 2001 22:25:49 +0100 (MET)) Subject: Re: Bug000323 References: <200101302125 DOT WAA29699 AT father 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 > -extern char *__file_handle_modes; > +extern unsigned short *__file_handle_modes; Could this in any way affect already-compiled libraries or programs? > Index: src/libc/ansi/stdio/doprnt.c > + > + if (fp->_flag & _IOAPPEND) > + { > + if ( llseek(fileno(fp), 0, SEEK_END) == -1 ) > + { > + return (EOF); > + } > + } This shouldn't be needed; the flsbuf() call should move to EOF. > - n = _write(fileno(f), base, rn); > + { > + if ( f->_flag & _IOAPPEND ) > + { > + int save_errno = errno; /* We don't want llseek()'s setting > + errno to remain. */ > + if( llseek(fileno(f), 0, SEEK_END) == -1 ) > + { > + errno = save_errno; > + n = 0; > + } > + else > + { > + n = _write(fileno(f), base, rn); > + } > + } > + else > + { > + n = _write(fileno(f), base, rn); > + } > + } Can we remove all the else cases, and have llseek return a failure if we can't seek? Then we'd have just one _write() call left (the original one, left there). > @@ -56,7 +57,9 @@ fopen(const char *file, const char *mode > return NULL; > > if (*mode == 'a') > - lseek(fd, 0, SEEK_END); > + { > + f->_flag |= _IOAPPEND; > + } Is this needed? write() would seek there anyway.