From: Paul Eggert Date: Wed, 11 Sep 2013 08:24:05 +0000 (-0700) Subject: Fix corruption with multiple emacsclient -t instances. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1662^2~42 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=73f82c7e8eb6a009248f4ea6360b2182d06f55e2;p=emacs.git 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 --- 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 + + 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 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. */