From 550147fd67f03aba27545b80d4b62d3fd3a6ed39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 12 Jan 2015 16:59:50 +0100 Subject: [PATCH] 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 --- src/unix/tty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unix/tty.c b/src/unix/tty.c index 068025ea..191964da 100644 --- a/src/unix/tty.c +++ b/src/unix/tty.c @@ -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;