]> granicus.if.org Git - python/commitdiff
In tcsetattr(), first initialize the mode structure by calling
authorGuido van Rossum <guido@python.org>
Fri, 12 Jun 1998 14:26:18 +0000 (14:26 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 12 Jun 1998 14:26:18 +0000 (14:26 +0000)
tcgetattr().  This seems to be the only correct way to cope with
platform-specific structure members...

Modules/termios.c

index 55295a8e45e113dd001d19ac3494249234f3b4b2..d7afeaec685334b6d9b040afd3c650710b888974 100644 (file)
@@ -139,6 +139,9 @@ termios_tcsetattr(self, args)
                return NULL;
        }
 
+       /* Get the old mode, in case there are any hidden fields... */
+       if (tcgetattr(fd, &mode) == -1)
+               return PyErr_SetFromErrno(TermiosError);
        mode.c_iflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 0));
        mode.c_oflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 1));
        mode.c_cflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 2));