PR lib/53615

getch() and get_wch() should return KEY_RESIZE when interrupted by SIGWINCH.

OK roy
This commit is contained in:
rin 2018-09-18 22:46:18 +00:00
parent b2d60dd6a2
commit 88ccf2cadc
2 changed files with 17 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: get_wch.c,v 1.14 2017/01/31 09:17:53 roy Exp $ */
/* $NetBSD: get_wch.c,v 1.15 2018/09/18 22:46:18 rin Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,9 +36,10 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: get_wch.c,v 1.14 2017/01/31 09:17:53 roy Exp $");
__RCSID("$NetBSD: get_wch.c,v 1.15 2018/09/18 22:46:18 rin Exp $");
#endif /* not lint */
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@ -596,7 +597,12 @@ wget_wch(WINDOW *win, wint_t *ch)
if (ferror(infd)) {
clearerr(infd);
return ERR;
if (errno == EINTR && _cursesi_screen->resized) {
_cursesi_screen->resized = 0;
*ch = KEY_RESIZE;
return KEY_CODE_YES;
} else
return ERR;
} else {
ret = c;
inp = c;

View File

@ -1,4 +1,4 @@
/* $NetBSD: getch.c,v 1.65 2017/01/31 09:17:53 roy Exp $ */
/* $NetBSD: getch.c,v 1.66 2018/09/18 22:46:18 rin Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,10 +34,11 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: getch.c,v 1.65 2017/01/31 09:17:53 roy Exp $");
__RCSID("$NetBSD: getch.c,v 1.66 2018/09/18 22:46:18 rin Exp $");
#endif
#endif /* not lint */
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@ -889,7 +890,11 @@ wgetch(WINDOW *win)
if (ferror(infd)) {
clearerr(infd);
inp = ERR;
if (errno == EINTR && _cursesi_screen->resized) {
_cursesi_screen->resized = 0;
inp = KEY_RESIZE;
} else
inp = ERR;
} else {
inp = c;
}