abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 3e3308d4e3a9f46c60d2eaa99361233c999dab27
parent fdbda9313163301ce0157f1b8eea229e6b6a6021
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 17 Mar 2018 10:38:21 +0100

Only manipulate output terminal state if it is a terminal

Diffstat:
client.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/client.c b/client.c @@ -22,8 +22,9 @@ static bool client_recv_packet(Packet *pkt) { } static void client_restore_terminal(void) { - if (has_term) - tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_term); + if (!has_term) + return; + tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_term); if (alternate_buffer) { printf("\033[?25h\033[?1049l"); fflush(stdout); @@ -32,6 +33,8 @@ static void client_restore_terminal(void) { } static void client_setup_terminal(void) { + if (!has_term) + return; atexit(client_restore_terminal); cur_term = orig_term;