This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA/commit] Handle EOF on terminals opened with ENONBLOCK...


> Date: Thu, 23 Apr 2009 13:37:10 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> > I suppose the errno == EAGAIN is supposed to check whether fgetc()
> > failed.  However, your code has an ferror() in between, which could
> > clobber errno.  So perhaps it is better to reverse those checks.
> 
> I did it in that order because I wanted to test the error condition
> on the FILE before actually checking errno. The C99 draft that I have
> does not say anything about errno, but the man page on my GNU/Linux
> machine does say explicitly that errno doesn't get set during
> a call to ferror.
> 
> I can try reversing them, though... Let me know if you think I should.

Hmm, looking at the OpenBSD and Solaris implementations of ferror(3),
they both are just checking a flag. so what you currently have should
be safe.


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