This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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: _IO_wfile_underflow_mmap error/eof case


> Roland McGrath wrote:
> > It seems to me that:
> > 
> >       fp->_flags |= _IO_EOF_SEEN;
> > 
> > in _IO_wfile_underflow_mmap is wrong.  In that case,
> > _IO_file_underflow_mmap has already set either the EOF or ERROR flag bit.
> > If there was an error rather than EOF, the EOF bit should not be set too.
> > Am I missing something or should I remove this line?
> 
> Might just be a copy&paste thing.  Is it noticeable from user code?  Or 
> the other way around: do you have code which stresses this code?

I just noticed the issue when reading over the code.  It would be
noticeable if the case I mentioned were to happen (instead of ferror(fp)=1
and feof(fp)=0 it would produce ferror(fp)=1 and feof(fp)=1).  The only way
this case comes up is if there is a failure in the lseek system call made
in _IO_file_underflow_mmap.  So I'm not sure there is a practical way to
see it in a test program (without doing something definitely bogus and
undefined/unspecified like closing the fd from under it).


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