Module Name:    src
Committed By:   rin
Date:           Tue Sep 18 22:46:18 UTC 2018

Modified Files:
        src/lib/libcurses: get_wch.c getch.c

Log Message:
PR lib/53615

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

OK roy


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libcurses/get_wch.c
cvs rdiff -u -r1.65 -r1.66 src/lib/libcurses/getch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/get_wch.c
diff -u src/lib/libcurses/get_wch.c:1.14 src/lib/libcurses/get_wch.c:1.15
--- src/lib/libcurses/get_wch.c:1.14	Tue Jan 31 09:17:53 2017
+++ src/lib/libcurses/get_wch.c	Tue Sep 18 22:46:18 2018
@@ -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;

Index: src/lib/libcurses/getch.c
diff -u src/lib/libcurses/getch.c:1.65 src/lib/libcurses/getch.c:1.66
--- src/lib/libcurses/getch.c:1.65	Tue Jan 31 09:17:53 2017
+++ src/lib/libcurses/getch.c	Tue Sep 18 22:46:18 2018
@@ -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;
 		}

Reply via email to