summaryrefslogtreecommitdiff
path: root/src/fe-text/terminfo-core.c
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-22 15:21:20 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-22 15:21:20 +0100
commit938d0071c6119f7ec9aeaa88913c47f7af267131 (patch)
treed72f50aca2696b37e2abda812c40d3fd8540f940 /src/fe-text/terminfo-core.c
parentf7658640fba5536e6dbfc2014b28523d8510e970 (diff)
downloadirssi-938d0071c6119f7ec9aeaa88913c47f7af267131.zip
fix race condition in terminal init
remove the tcgetattr call to a single time on irssi load instead of querying it each time. Fixes #450
Diffstat (limited to 'src/fe-text/terminfo-core.c')
-rw-r--r--src/fe-text/terminfo-core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index 60927f1a..4db68cc7 100644
--- a/src/fe-text/terminfo-core.c
+++ b/src/fe-text/terminfo-core.c
@@ -496,7 +496,7 @@ void terminfo_setup_colors(TERM_REC *term, int force)
}
}
-static void terminfo_input_init(TERM_REC *term)
+static void terminfo_input_init0(TERM_REC *term)
{
tcgetattr(fileno(term->in), &term->old_tio);
memcpy(&term->tio, &term->old_tio, sizeof(term->tio));
@@ -518,8 +518,11 @@ static void terminfo_input_init(TERM_REC *term)
term->tio.c_cc[VSUSP] = _POSIX_VDISABLE;
#endif
- tcsetattr(fileno(term->in), TCSADRAIN, &term->tio);
+}
+static void terminfo_input_init(TERM_REC *term)
+{
+ tcsetattr(fileno(term->in), TCSADRAIN, &term->tio);
}
static void terminfo_input_deinit(TERM_REC *term)
@@ -673,6 +676,7 @@ static int term_setup(TERM_REC *term)
term->beep = term->TI_bel ? _beep : _ignore;
terminfo_setup_colors(term, FALSE);
+ terminfo_input_init0(term);
terminfo_cont(term);
return 1;
}