unix: make setting the tty mode to the same value a no-op

Closes #131

PR-URL: https://github.com/libuv/libuv/pull/132
Reviewed-By: Bert Belder <bertbelder@gmail.com>
This commit is contained in:
Saúl Ibarra Corretgé 2015-01-12 16:59:50 +01:00
parent c3e22b7581
commit 550147fd67

View File

@ -108,8 +108,10 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
struct termios tmp;
int fd;
fd = uv__stream_fd(tty);
if (tty->mode == mode)
return 0;
fd = uv__stream_fd(tty);
if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) {
if (tcgetattr(fd, &tty->orig_termios))
return -errno;