This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ldlex should use streams


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]