This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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]

bug in ferror


Hi all,

I think I've discovered a bug in ferror. ferror() is return 1 for EOF. ferror() should return 0 for EOF. This is messing up a lex parser that was generated by flex. The ferror routine should check for EOF before returning an error.

Here's my update to ferror:

/ecos/packages/language/c/libc/stdio/current/src/common/feof.cxx: line 64

externC int
ferror( FILE *stream )
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;

// EOF is not an error
if (real_stream->get_eof_state() != 0) return 0;

return (real_stream->get_error() != 0);
} // ferror()



--
Stephen Polkowski
Centaur Technology
Austin, TX
(512) 418-5730


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



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