summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2009-10-31 12:58:13 +0000
committerRong-En Fan <rafan@FreeBSD.org>2009-10-31 12:58:13 +0000
commit08ff25d373f0f63b805932c38a0e4247573367ae (patch)
treeaf1ca0186c40087e6c87ab5aa9e51e98cd412881
parent337287c2c86f1f87805e58f7e954635821c0ce6c (diff)
downloadsrc-test2-08ff25d373f0f63b805932c38a0e4247573367ae.tar.gz
src-test2-08ff25d373f0f63b805932c38a0e4247573367ae.zip
MFC r198490
Pull upstream patch to fix ee(1) crash when received SIGWINCH: modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a SIGWINCH, and discard that value, to avoid confusing application (patch by Eygene Ryabinkin, FreeBSD bin/136223). PR: 136223 Submitted by: Eygene Ryabinkin Obtained from: ncurses-5.7-20091024 snapshot Approved by: re (kib@)
Notes
Notes: svn path=/releng/8.0/; revision=198716
-rw-r--r--contrib/ncurses/ncurses/base/lib_getch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c
index a3812bee76e8..e7ba0b210e34 100644
--- a/contrib/ncurses/ncurses/base/lib_getch.c
+++ b/contrib/ncurses/ncurses/base/lib_getch.c
@@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
/* resizeterm can push KEY_RESIZE */
if (cooked_key_in_fifo()) {
*result = fifo_pull(sp);
+ /*
+ * Get the ERR from queue -- it is from WINCH,
+ * so we should take it out, the "error" is handled.
+ */
+ if (fifo_peek(sp) == -1)
+ fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
}