From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 24 12:04:36 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22BBA106566C for ; Sat, 24 Oct 2009 12:04:36 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id D4F1D8FC17 for ; Sat, 24 Oct 2009 12:04:35 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id C622135A821; Sat, 24 Oct 2009 14:04:34 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id B22CD228BE; Sat, 24 Oct 2009 14:04:34 +0200 (CEST) Date: Sat, 24 Oct 2009 14:04:34 +0200 From: Jilles Tjoelker To: Eygene Ryabinkin Message-ID: <20091024120434.GA27808@stack.nl> References: <86tyxqqpwh.fsf@ds4.des.no> <8gJJDa6kRsCUwxK/zidtHIOFMRw@LbQSLh99U4wa807TkC1GazBU7WI> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8gJJDa6kRsCUwxK/zidtHIOFMRw@LbQSLh99U4wa807TkC1GazBU7WI> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers@freebsd.org Subject: Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Oct 2009 12:04:36 -0000 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