diff options
author | Guido van Rossum <guido@python.org> | 1998-06-12 14:26:18 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-06-12 14:26:18 (GMT) |
commit | e7c4193755843e308df180f3014cea214fbf6dc5 (patch) | |
tree | d2245791585a70070682bac4a8c96d2275ed74ec /Modules/termios.c | |
parent | ae9ee7329d350b57a2d7b835e4e77a00b67e21b6 (diff) | |
download | cpython-e7c4193755843e308df180f3014cea214fbf6dc5.zip cpython-e7c4193755843e308df180f3014cea214fbf6dc5.tar.gz cpython-e7c4193755843e308df180f3014cea214fbf6dc5.tar.bz2 |
In tcsetattr(), first initialize the mode structure by calling
tcgetattr(). This seems to be the only correct way to cope with
platform-specific structure members...
Diffstat (limited to 'Modules/termios.c')
-rw-r--r-- | Modules/termios.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/termios.c b/Modules/termios.c index 55295a8..d7afeae 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -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)); |