diff --git a/lib/tty/tty-internal.c b/lib/tty/tty-internal.c index ff159a4ee..1236d0540 100644 --- a/lib/tty/tty-internal.c +++ b/lib/tty/tty-internal.c @@ -84,6 +84,7 @@ tty_create_winch_pipe (void) fprintf (stderr, _("\nCannot configure write end of SIGWINCH pipe: %s (%d)\n"), mcerror->message, mcerror->code); g_error_free (mcerror); + tty_destroy_winch_pipe (); exit (EXIT_FAILURE); } @@ -92,8 +93,18 @@ tty_create_winch_pipe (void) fprintf (stderr, _("\nCannot configure read end of SIGWINCH pipe: %s (%d)\n"), mcerror->message, mcerror->code); g_error_free (mcerror); + tty_destroy_winch_pipe (); exit (EXIT_FAILURE); } } /* --------------------------------------------------------------------------------------------- */ + +void +tty_destroy_winch_pipe (void) +{ + (void) close (sigwinch_pipe[0]); + (void) close (sigwinch_pipe[1]); +} + +/* --------------------------------------------------------------------------------------------- */ diff --git a/lib/tty/tty-internal.h b/lib/tty/tty-internal.h index 5b367f41a..662b0bcaf 100644 --- a/lib/tty/tty-internal.h +++ b/lib/tty/tty-internal.h @@ -36,6 +36,7 @@ extern int sigwinch_pipe[2]; /*** declarations of public functions ************************************************************/ void tty_create_winch_pipe (void); +void tty_destroy_winch_pipe (void); char *mc_tty_normalize_from_utf8 (const char *); void tty_init_xterm_support (gboolean is_xterm); diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index b8a3577a8..2579a0a99 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -230,6 +230,7 @@ tty_init (gboolean mouse_enable, gboolean is_xterm) void tty_shutdown (void) { + tty_destroy_winch_pipe (); tty_reset_shell_mode (); tty_noraw_mode (); tty_keypad (FALSE); diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index 99372d046..10cce4e0d 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -343,6 +343,7 @@ tty_shutdown (void) { char *op_cap; + tty_destroy_winch_pipe (); tty_reset_shell_mode (); tty_noraw_mode (); tty_keypad (FALSE);