Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Oct 2009 14:04:34 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Message-ID:  <20091024120434.GA27808@stack.nl>
In-Reply-To: <8gJJDa6kRsCUwxK/zidtHIOFMRw@LbQSLh99U4wa807TkC1GazBU7WI>
References:  <permail-20091023104227f0889e8400002915-a_best01@message-id.uni-muenster.de> <86tyxqqpwh.fsf@ds4.des.no> <8gJJDa6kRsCUwxK/zidtHIOFMRw@LbQSLh99U4wa807TkC1GazBU7WI>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 23, 2009 at 07:56:35PM +0400, Eygene Ryabinkin wrote:
> Hmm, we can transform this code to the following one:
> -----
> errno = 0;
> do {
> 	in = wgetch(text_win);
> } while (errno == EINTR);
> if (in == -1)
> 	exit(0);
> -----
> This won't help with FreeBSD's ncurses, but may be other variants
> will feel much better with such a event loop variant.

That should be:
-----
do
	in = wgetch(text_win);
while (in == -1 && errno == EINTR);
if (in == -1)
	exit(0);
-----

errno should only be checked after failed function calls or for
functions where it is documented that errno should be used to check for
error conditions (example: readdir).

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091024120434.GA27808>