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.
This commit is contained in:
Martin Lund 2016-04-24 15:43:56 +02:00
parent c6c4a4b1dd
commit 9f38512285

View file

@ -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);