aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2009-10-26 13:01:29 +0000
committerRong-En Fan <rafan@FreeBSD.org>2009-10-26 13:01:29 +0000
commit90f241383ea9bf3c9fb230e79e49f6602ddcb113 (patch)
tree07aa603b06440d04b85e639f04bb200c23e48a06
parent6181f4622a00a9de81df01cecb5fa73ffdb697bc (diff)
downloadsrc-90f241383ea9bf3c9fb230e79e49f6602ddcb113.tar.gz
src-90f241383ea9bf3c9fb230e79e49f6602ddcb113.zip
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 MFC after: 3 days
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=198489
-rw-r--r--ncurses/base/lib_getch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c
index a3812bee76e8..e7ba0b210e34 100644
--- a/ncurses/base/lib_getch.c
+++ b/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);
}
}