This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ldlex should use streams
- From: Ian Lance Taylor <ian at airs dot com>
- To: binutils at sources dot redhat dot com
- Date: 24 Jan 2002 10:12:51 -0800
- Subject: Re: ldlex should use streams
- References: <u8r8olv5vc.fsf@gromit.moeb>
Andreas Jaeger <aj@suse.de> writes:
> @@ -595,7 +595,7 @@
> {
> if (yyin)
> {
> - *result = read (fileno (yyin), (char *) buf, max_size);
> + *result = fread ((char *) buf, 1, max_size, yyin);
> if (*result < 0)
> einfo ("%F%P: read in flex scanner failed\n");
> }
If you change read to fread, you have to change the error check.
fread will never return a negative value. You have to check for a
short count, and use ferror.
Ian