Commit Diff


commit - 3ce23c08d0d60bb7cba4f349d1a95b893d6b8e0b
commit + 84d6fbcbec1d1485b243531411bc4d8ab071fafb
blob - b7bcd30997dfa5a49ab5ddb9de9c8c643f3a7aec
blob + 38b7e1d31d902c5ccf34f2924485fa6abe133bb8
--- commands.c
+++ commands.c
@@ -76,6 +76,8 @@ struct intlist *whichlist;
 
 pid_t	child;
 
+extern volatile sig_atomic_t caught_sigwinch;
+
 static int	disable(void);
 static int      clear(void);
 static int	doverbose(int, char**);
@@ -1990,6 +1992,10 @@ command()
 	}
 
 	for (;;) {
+		if (caught_sigwinch) {
+			(void)setwinsize(caught_sigwinch);
+			caught_sigwinch = 0;
+		}
 		if (!editing) {
 			if (interactive_mode)
 				printf("%s", cprompt());
blob - 0d4fefb0968228cce0021613fa31b04e65c6f131
blob + ed3d6b6e054eea4ba1775548671e4163bb6ebf41
--- main.c
+++ main.c
@@ -55,6 +55,14 @@ char *cursor_pos = NULL;
 struct hashtable *nsh_env;	/* per-user session environment variables */
 
 void intr(void);
+
+volatile sig_atomic_t caught_sigwinch;
+
+void
+catchsigwinch(int signo)
+{
+	caught_sigwinch = signo;
+}
 
 static void
 load_userenv(void)
@@ -313,7 +321,7 @@ main(int argc, char *argv[])
 
 	top = setjmp(toplevel) == 0;
 	if (top) {
-		(void)signal(SIGWINCH, setwinsize);
+		(void)signal(SIGWINCH, catchsigwinch);
 		(void)signal(SIGINT, (sig_t)intr);
 		(void)setwinsize(0);
 	} else