summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-09-11 01:24:05 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-09-11 01:24:05 -0700
commit73f82c7e8eb6a009248f4ea6360b2182d06f55e2 (patch)
tree72a9eddac1e2c9c1db8a62b97031f72d53b66140
parent53482f41157f37a7f6afb7f19be8fc63b015f6ed (diff)
downloademacs-73f82c7e8eb6a009248f4ea6360b2182d06f55e2.tar.gz
Fix corruption with multiple emacsclient -t instances.
This bug was introduced by my 2013-08-26 patch, which incorrectly assumed that the terminfo implementation doesn't use termcap buffers. * term.c (init_tty) [TERMINFO]: Remove optimization, as these buffers apparently are used after all. * termchar.h (TERMCAP_BUFFER_SIZE) [TERMINFO]: Define here too. (struct tty_display_info): Define members termcap_term_buffer and termcap_strings_buffer even if TERMINFO. Fixes: debbugs:15222
-rw-r--r--src/ChangeLog11
-rw-r--r--src/term.c10
-rw-r--r--src/termchar.h4
3 files changed, 11 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f51e6a147bf..21cb47eeeaa 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2013-09-11 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix corruption with multiple emacsclient -t instances (Bug#15222).
+ This bug was introduced by my 2013-08-26 patch, which incorrectly
+ assumed that the terminfo implementation doesn't use termcap buffers.
+ * term.c (init_tty) [TERMINFO]: Remove optimization, as
+ these buffers apparently are used after all.
+ * termchar.h (TERMCAP_BUFFER_SIZE) [TERMINFO]: Define here too.
+ (struct tty_display_info): Define members termcap_term_buffer and
+ termcap_strings_buffer even if TERMINFO.
+
2013-09-11 Dmitry Antipov <dmantipov@yandex.ru>
Fix last change.
diff --git a/src/term.c b/src/term.c
index 0270c1eefa6..fd5ea5a1b8d 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2917,12 +2917,8 @@ dissociate_if_controlling_tty (int fd)
struct terminal *
init_tty (const char *name, const char *terminal_type, bool must_succeed)
{
-#ifdef TERMINFO
- char **address = 0;
-#else
char *area;
char **address = &area;
-#endif
int status;
struct tty_display_info *tty = NULL;
struct terminal *terminal = NULL;
@@ -3013,13 +3009,9 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
/* On some systems, tgetent tries to access the controlling
terminal. */
block_tty_out_signal ();
-#ifdef TERMINFO
- status = tgetent (0, terminal_type);
-#else
status = tgetent (tty->termcap_term_buffer, terminal_type);
if (tty->termcap_term_buffer[TERMCAP_BUFFER_SIZE - 1])
emacs_abort ();
-#endif
unblock_tty_out_signal ();
if (status < 0)
@@ -3050,9 +3042,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
terminal_type);
}
-#ifndef TERMINFO
area = tty->termcap_strings_buffer;
-#endif
tty->TS_ins_line = tgetstr ("al", address);
tty->TS_ins_multi_lines = tgetstr ("AL", address);
tty->TS_bell = tgetstr ("bl", address);
diff --git a/src/termchar.h b/src/termchar.h
index 687f7fbd119..11cea34df23 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -30,9 +30,7 @@ struct tty_output
/* There is nothing else here at the moment... */
};
-#ifndef TERMINFO
enum { TERMCAP_BUFFER_SIZE = 4096 };
-#endif
/* Parameters that are shared between frames on the same tty device. */
@@ -78,7 +76,6 @@ struct tty_display_info
mouse-face. */
Mouse_HLInfo mouse_highlight;
-#ifndef TERMINFO
/* Buffer used internally by termcap (see tgetent in the Termcap
manual). Only init_tty should use this. */
char termcap_term_buffer[TERMCAP_BUFFER_SIZE];
@@ -86,7 +83,6 @@ struct tty_display_info
/* Buffer storing terminal description strings (see tgetstr in the
Termcap manual). Only init_tty should use this. */
char termcap_strings_buffer[TERMCAP_BUFFER_SIZE];
-#endif
/* Strings, numbers and flags taken from the termcap entry. */