From: Alain Magloire Message-Id: <199910212124.RAA11174@mccoy2.ECE.McGill.CA> Subject: Re: Bug in fsetpos()? To: djgpp-workers AT delorie DOT com Date: Thu, 21 Oct 1999 17:24:07 -0400 (EDT) In-Reply-To: <380EB83B.D9BB7F9@tudor21.net> from "Richard Dawe" at Oct 21, 99 07:52:43 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Bonjour M. Richard Dawe > > I was looking at fseek(), fgetpos(), fsetpos() earlier and I noticed that > fsetpos() appears to ignore the return value of fseek(). Is this intended? > If not, there's a patch below to fix it. I also altered the return value > to be -1, to be consistent with fseek(). If this is the intended > behaviour, may I ask why? > > Here's the patch: I don't think this is a bug, fsetpos() returns 0 if it succeeds otherwise it returns a non-zero value and sets errno to indicate the error. However all implemetations have seen just call fseek() int fsetpos(FILE *stream, const fpos_t *pos) { return fseek(stream, *pos, SEEK_SET); } and let errno propagates up, I did not expect the EFAULT. I agree that consistency is good, but this is not a bug and no particular meaning should be taken on the return value besides != 0. if (fsetpos(stream, pos) < 0) { .. } /* wrong */ if (fsetpos(stream, pos) != 0) { .. } /* good */ Cheers .. -- au revoir, alain ---- Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!