aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-11-01 16:46:12 +0100
committerBruce Hill <bruce@bruce-hill.com>2019-11-01 16:46:12 +0100
commit2086cc6598b354bf298b802368807ac66d26fd21 (patch)
treec339da55710d8f82b1f2fb810ce321280e1f7079 /bb.c
parent66d20ba811587f85774c475f38d94d5959c8f2d0 (diff)
Fix for errors that occur before initializing the terminal.
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c8
1 files 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);
+ }
}
/*