diff options
author | jilles <jilles@FreeBSD.org> | 2014-01-14 22:56:25 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2014-01-14 22:56:25 +0000 |
commit | 296c7c9901f4ba3bb507dd6503d02949adb658a5 (patch) | |
tree | 8d778b850ab191014fb1bafc20c9ba9dd5084b3a /bin | |
parent | 2c937dd4c77f2d22e7d7f517c42b623045be22ad (diff) | |
download | FreeBSD-src-296c7c9901f4ba3bb507dd6503d02949adb658a5.zip FreeBSD-src-296c7c9901f4ba3bb507dd6503d02949adb658a5.tar.gz |
sh: Remove SIGWINCH handler and just check for resize before every read.
The SIGWINCH handler triggers breakage in libedit which is hard to fix; see
PR bin/169773.
Also, window size changes while a program is in foreground (and it rather
than sh will receive SIGWINCH) will now be picked up automatically.
Downside: it is now certain that a resize is only processed after pressing
<Enter>. If libedit is fixed, sh will most likely have to be changed also.
PR: bin/180146
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/input.c | 10 | ||||
-rw-r--r-- | bin/sh/trap.c | 15 | ||||
-rw-r--r-- | bin/sh/trap.h | 1 |
3 files changed, 3 insertions, 23 deletions
diff --git a/bin/sh/input.c b/bin/sh/input.c index e527d36..94fbd79 100644 --- a/bin/sh/input.c +++ b/bin/sh/input.c @@ -162,20 +162,16 @@ preadfd(void) int nr; parsenextc = parsefile->buf; -#ifndef NO_HISTORY - if (el != NULL && gotwinch) { - gotwinch = 0; - el_resize(el); - } -#endif retry: #ifndef NO_HISTORY if (parsefile->fd == 0 && el) { static const char *rl_cp; static int el_len; - if (rl_cp == NULL) + if (rl_cp == NULL) { + el_resize(el); rl_cp = el_gets(el, &el_len); + } if (rl_cp == NULL) nr = el_len == 0 ? 0 : -1; else { diff --git a/bin/sh/trap.c b/bin/sh/trap.c index 1b2c354..e5a2a91 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -80,7 +80,6 @@ static char *volatile trap[NSIG]; /* trap handler commands */ static volatile sig_atomic_t gotsig[NSIG]; /* indicates specified signal received */ static int ignore_sigchld; /* Used while handling SIGCHLD traps. */ -volatile sig_atomic_t gotwinch; static int last_trapsig; static int exiting; /* exitshell() has been called */ @@ -293,12 +292,6 @@ setsignal(int signo) action = S_IGN; break; #endif -#ifndef NO_HISTORY - case SIGWINCH: - if (rootshell && iflag) - action = S_CATCH; - break; -#endif } } @@ -400,11 +393,6 @@ onsig(int signo) gotsig[signo] = 1; pendingsig = signo; } - -#ifndef NO_HISTORY - if (signo == SIGWINCH) - gotwinch = 1; -#endif } @@ -490,9 +478,6 @@ setinteractive(int on) setsignal(SIGINT); setsignal(SIGQUIT); setsignal(SIGTERM); -#ifndef NO_HISTORY - setsignal(SIGWINCH); -#endif is_interactive = on; } diff --git a/bin/sh/trap.h b/bin/sh/trap.h index a962251..541b9b1 100644 --- a/bin/sh/trap.h +++ b/bin/sh/trap.h @@ -36,7 +36,6 @@ extern volatile sig_atomic_t pendingsig; extern volatile sig_atomic_t pendingsig_waitcmd; extern int in_dotrap; -extern volatile sig_atomic_t gotwinch; void clear_traps(void); int have_traps(void); |