]> git.eshelyaron.com Git - emacs.git/commitdiff
Cleanup when opening a new terminal fails. (Bug#32794)
authorJohn Shahid <jvshahid@gmail.com>
Fri, 21 Sep 2018 15:15:10 +0000 (11:15 -0400)
committerEli Zaretskii <eliz@gnu.org>
Sat, 29 Sep 2018 06:30:01 +0000 (09:30 +0300)
* src/term.c (init_tty): Call delete_terminal_internal if emacs_open
fail.
* src/terminal.c (delete_terminal): Move some code into
delete_terminal_internal and call it.
(delete_terminal_internal): New function.
* src/termhooks.h: Prototype for delete_terminal_internal.

src/term.c
src/termhooks.h
src/terminal.c

index f542fc527c4664ca6ad142804c24b744909ab2f0..8493cc02c4d61e4c5e37bbf55fe2b25660acee5e 100644 (file)
@@ -4004,6 +4004,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
        char const *diagnostic
          = (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s";
        emacs_close (fd);
+        delete_terminal_internal (terminal);
        maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name);
       }
 
index 1b2c95e82481ee7eaf6ff7596c01451ed384530c..543809b9e40ae66f2a955ddaad90723f9d5ac10d 100644 (file)
@@ -729,6 +729,7 @@ extern struct terminal *get_named_terminal (const char *);
 extern struct terminal *create_terminal (enum output_method,
                                         struct redisplay_interface *);
 extern void delete_terminal (struct terminal *);
+extern void delete_terminal_internal (struct terminal *);
 extern Lisp_Object terminal_glyph_code (struct terminal *, int);
 
 /* The initial terminal device, created by initial_term_init.  */
index 070b8aac1fefa6f1e59c5db259ab52f8cb6f2c9c..043ee67e0c1568dc5f71a88cb2cc64f8d09c11b0 100644 (file)
@@ -314,7 +314,6 @@ create_terminal (enum output_method type, struct redisplay_interface *rif)
 void
 delete_terminal (struct terminal *terminal)
 {
-  struct terminal **tp;
   Lisp_Object tail, frame;
 
   /* Protect against recursive calls.  delete_frame calls the
@@ -335,6 +334,14 @@ delete_terminal (struct terminal *terminal)
         }
     }
 
+  delete_terminal_internal (terminal);
+}
+
+void
+delete_terminal_internal (struct terminal *terminal)
+{
+  struct terminal **tp;
+
   for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal)
     if (! *tp)
       emacs_abort ();