about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2013-04-28 17:47:43 -0700
committerBart Schaefer <schaefer@zsh.org>2013-04-30 00:08:49 -0700
commitd19e18c68d6415214afad37ce6cb47ec038ebe1c (patch)
treec325d0ca0440246d07b758c25a20d6c5f49356b4 /Src/Zle
parentcbf6f144a942a3db27025e68357b9fd8ca442ed8 (diff)
downloadzsh-d19e18c68d6415214afad37ce6cb47ec038ebe1c.tar.gz
zsh-d19e18c68d6415214afad37ce6cb47ec038ebe1c.tar.xz
zsh-d19e18c68d6415214afad37ce6cb47ec038ebe1c.zip
31350: block SIGWINCH nearly all the time, except
when about to calculate prompts or do synchronous read, so
syscalls are not interrupted by window size changes.
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 9a4265f06..569ad5f5a 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -567,7 +567,9 @@ raw_getbyte(long do_keytmout, char *cptr)
 	gettyinfo(&ti);
 	ti.tio.c_cc[VMIN] = 0;
 	settyinfo(&ti);
+	winch_unblock();
 	ret = read(SHTTY, cptr, 1);
+	winch_block();
 	ti.tio.c_cc[VMIN] = 1;
 	settyinfo(&ti);
 	if (ret > 0)
@@ -597,7 +599,9 @@ raw_getbyte(long do_keytmout, char *cptr)
 	    else
 		poll_timeout = -1;
 
+	    winch_unblock();
 	    selret = poll(fds, errtry ? 1 : nfds, poll_timeout);
+	    winch_block();
 # else
 	    int fdmax = SHTTY;
 	    struct timeval *tvptr;
@@ -622,8 +626,10 @@ raw_getbyte(long do_keytmout, char *cptr)
 	    else
 		tvptr = NULL;
 
+	    winch_unblock();
 	    selret = select(fdmax+1, (SELECT_ARG_2_T) & foofd,
 			    NULL, NULL, tvptr);
+	    winch_block();
 # endif
 	    /*
 	     * Make sure a user interrupt gets passed on straight away.
@@ -788,7 +794,9 @@ raw_getbyte(long do_keytmout, char *cptr)
 #  else
 	ioctl(SHTTY, TCSETA, &ti.tio);
 #  endif
+	winch_unblock();
 	ret = read(SHTTY, cptr, 1);
+	winch_block();
 #  ifdef HAVE_TERMIOS_H
 	tcsetattr(SHTTY, TCSANOW, &shttyinfo.tio);
 #  else
@@ -799,7 +807,9 @@ raw_getbyte(long do_keytmout, char *cptr)
 #endif
     }
 
+    winch_unblock();
     ret = read(SHTTY, cptr, 1);
+    winch_block();
 
     return ret;
 }