From d516376ce768dd66433c919c9c97b5cde1c3221a Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 9 Dec 2015 20:07:22 +0100 Subject: [PATCH] Improve the support for pseudo terminals. Apparantly Fedora applies a custom patch to glibc's tcsetattr() function, which adds an extra check to verify the PARENB/CREAD/CSIZE bits in the termios c_cflag field. However, in commit 197b9f09421111e03588c94d55a72aa6ec624c63 we already discovered that for pty's, some of the termios settings make no sense at all, and therefore the Linux kernel always does: tty->termios.c_cflag &= ~(CSIZE | PARENB); tty->termios.c_cflag |= (CS8 | CREAD); Thus, instead of ignoring such nonsense termios settings, the kernel changes the termios structure to reflect what pty's actually do. The consequence is that these settings will not stick, and cause the extra check in the Fedora specific patch to fail. To workaround this problem, we ignore the error when building libdivecomputer with pty support enabled. --- src/serial_posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serial_posix.c b/src/serial_posix.c index 2b0c3fa..af4beba 100644 --- a/src/serial_posix.c +++ b/src/serial_posix.c @@ -417,7 +417,7 @@ serial_configure (serial_t *device, int baudrate, int databits, int parity, int } // Apply the new settings. - if (tcsetattr (device->fd, TCSANOW, &tty) != 0) { + if (tcsetattr (device->fd, TCSANOW, &tty) != 0 && NOPTY) { SYSERROR (device->context, errno); return -1; }