aboutsummaryrefslogtreecommitdiff
path: root/src/unix/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/tty.c')
-rw-r--r--src/unix/tty.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/unix/tty.c b/src/unix/tty.c
index b1782df9..9038d85a 100644
--- a/src/unix/tty.c
+++ b/src/unix/tty.c
@@ -237,8 +237,10 @@ uv_handle_type uv_guess_handle(uv_file file) {
* critical section when the signal was raised.
*/
int uv_tty_reset_mode(void) {
+ int saved_errno;
int err;
+ saved_errno = errno;
if (!uv_spinlock_trylock(&termios_spinlock))
return -EBUSY; /* In uv_tty_set_mode(). */
@@ -248,5 +250,7 @@ int uv_tty_reset_mode(void) {
err = -errno;
uv_spinlock_unlock(&termios_spinlock);
+ errno = saved_errno;
+
return err;
}