Close sigwinch_pipe at shutdown.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2020-02-02 14:38:31 +03:00
parent b5dae72e1e
commit 9a57984974
4 changed files with 14 additions and 0 deletions

View File

@ -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]);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -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);

View File

@ -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);

View File

@ -343,6 +343,7 @@ tty_shutdown (void)
{
char *op_cap;
tty_destroy_winch_pipe ();
tty_reset_shell_mode ();
tty_noraw_mode ();
tty_keypad (FALSE);