Date: Fri, 23 Oct 2009 14:02:38 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Alexander Best <alexbestms@math.uni-muenster.de> Cc: Antony Mawer <lists@mawer.org>, freebsd-hackers@freebsd.org, pluknet <pluknet@gmail.com>, ed@freebsd.org, rafan@freebsd.org Subject: Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH Message-ID: <86tyxqqpwh.fsf@ds4.des.no> In-Reply-To: <permail-20091023104227f0889e8400002915-a_best01@message-id.uni-muenster.de> (Alexander Best's message of "Fri, 23 Oct 2009 12:42:27 %2B0200 (CEST)") References: <permail-20091023104227f0889e8400002915-a_best01@message-id.uni-muenster.de>
next in thread | previous in thread | raw e-mail | index | archive | help
[cc: ed for ee and rafan for ncurses]
Alexander Best <alexbestms@math.uni-muenster.de> writes:
> i'm not so sure this is entirely ee's fault.
It is *partly* ee's fault.
src/usr.bin/ee/ee.c in 7:
in = wgetch(text_win);
if (in == -1)
continue;
src/contrib/ee/ee.c in 8:
in = wgetch(text_win);
if (in == -1)
exit(0); /* without this exit ee will go into an
infinite loop if the network
session detaches */
>From the wgetch() man page:
Programmers concerned about portability should be prepared for either
of two cases: (a) signal receipt does not interrupt getch; (b) signal
receipt interrupts getch and causes it to return ERR with errno set to
EINTR. Under the ncurses implementation, handled signals never inter‐
rupt getch.
so ee is not portable (it should not assume that a "handled signal" such
as SIGWINCH does not interrupt wgetch()), but that's not the real issue.
The real issue, though, is that when a SIGWINCH is caught, wgetch()
correctly returns KEY_RESIZE, but the next call to wgetch() returns -1.
The next call after that is fine. I suspect the error lies somewhere
inside kgetch() in contrib/ncurses/ncurses/base/lib_getch.c.
DES
--
Dag-Erling Smørgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86tyxqqpwh.fsf>
