From 2086cc6598b354bf298b802368807ac66d26fd21 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 1 Nov 2019 16:46:12 +0100 Subject: [PATCH] Fix for errors that occur before initializing the terminal. --- bb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bb.c b/bb.c index 315b4f5..8369959 100644 --- a/bb.c +++ b/bb.c @@ -147,9 +147,11 @@ void cleanup(void) free(cmdfilename); cmdfilename = NULL; } - fputs(T_OFF(T_ALT_SCREEN) T_ON(T_SHOW_CURSOR), tty_out); - fflush(tty_out); - tcsetattr(fileno(tty_out), TCSANOW, &orig_termios); + if (tty_out) { + fputs(T_OFF(T_ALT_SCREEN) T_ON(T_SHOW_CURSOR), tty_out); + fflush(tty_out); + tcsetattr(fileno(tty_out), TCSANOW, &orig_termios); + } } /*