From 5217d9842bb7b24fa553b4ce7456b73269ae2fe5 Mon Sep 17 00:00:00 2001 From: George Stark Date: Thu, 19 Sep 2019 17:39:01 +0300 Subject: [PATCH] dont show line state if ioctl failed --- src/tty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tty.c b/src/tty.c index ae6f1a9..3b40e08 100644 --- a/src/tty.c +++ b/src/tty.c @@ -144,9 +144,11 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c case KEY_SHIFT_L: if (ioctl(fd, TIOCMGET, &state) < 0) + { error_printf("Could not get line state: %s", strerror(errno)); + break; + } tio_printf("Lines state:"); - tio_printf(" DTR: %s", (state & TIOCM_DTR) ? "HIGH" : "LOW"); tio_printf(" RTS: %s", (state & TIOCM_RTS) ? "HIGH" : "LOW"); tio_printf(" CTS: %s", (state & TIOCM_CTS) ? "HIGH" : "LOW");