From 9f38512285e673ee5c04f8322f74d72792d190e7 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sun, 24 Apr 2016 15:43:56 +0200 Subject: [PATCH] Do not quit on error This makes gotty more robust in the sense it will not quit when an error occurs but simply continue to try reconnect. --- src/tty.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/tty.c b/src/tty.c index aac148f..bd5f3f4 100644 --- a/src/tty.c +++ b/src/tty.c @@ -145,17 +145,11 @@ int connect_tty(void) /* Open tty device */ fd = open(option.tty_device, O_RDWR | O_NOCTTY ); if (fd < 0) - { - printf("\033[300DError: %s\n\033[300D", strerror(errno)); - exit(EXIT_FAILURE); - } + return EXIT_FAILURE; /* Make sure device is of tty type */ if (!isatty(fd)) - { - printf("\033[300DError: Not a tty device\n\033[300D"); - exit(EXIT_FAILURE); - } + return EXIT_FAILURE; /* Flush stale I/O data (if any) */ tcflush(fd, TCIOFLUSH);