From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: brobecker@adacore.com
Cc: mark.kettenis@xs4all.nl, gdb-patches@sourceware.org
Subject: Re: [RFA/commit] Handle EOF on terminals opened with ENONBLOCK...
Date: Thu, 23 Apr 2009 20:45:00 -0000 [thread overview]
Message-ID: <200904232044.n3NKimSD023708@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <20090423203710.GH7552@adacore.com> (message from Joel Brobecker on Thu, 23 Apr 2009 13:37:10 -0700)
> 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.
next prev parent reply other threads:[~2009-04-23 20:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 19:14 Joel Brobecker
2009-04-23 19:35 ` Mark Kettenis
2009-04-23 20:37 ` Joel Brobecker
2009-04-23 20:45 ` Mark Kettenis [this message]
2009-04-24 10:20 ` Eli Zaretskii
2009-05-06 23:02 ` Joel Brobecker
2009-05-07 3:13 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200904232044.n3NKimSD023708@brahms.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox