diff options
Diffstat (limited to 'Utilities/cmlibuv/src/unix/tty.c')
-rw-r--r-- | Utilities/cmlibuv/src/unix/tty.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Utilities/cmlibuv/src/unix/tty.c b/Utilities/cmlibuv/src/unix/tty.c index fc8c3ab..e8ea302 100644 --- a/Utilities/cmlibuv/src/unix/tty.c +++ b/Utilities/cmlibuv/src/unix/tty.c @@ -106,7 +106,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { */ type = uv_guess_handle(fd); if (type == UV_FILE || type == UV_UNKNOWN_HANDLE) - return -EINVAL; + return UV_EINVAL; /* Reopen the file descriptor when it refers to a tty. This lets us put the * tty in non-blocking mode without affecting other processes that share it @@ -139,7 +139,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { newfd = r; r = uv__dup2_cloexec(newfd, fd); - if (r < 0 && r != -EINVAL) { + if (r < 0 && r != UV_EINVAL) { /* EINVAL means newfd == fd which could conceivably happen if another * thread called close(fd) between our calls to isatty() and open(). * That's a rather unlikely event but let's handle it anyway. @@ -160,7 +160,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { if (saved_flags == -1) { if (newfd != -1) uv__close(newfd); - return -errno; + return UV__ERR(errno); } #endif @@ -231,7 +231,7 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { 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; + return UV__ERR(errno); /* This is used for uv_tty_reset_mode() */ uv_spinlock_lock(&termios_spinlock); @@ -261,7 +261,7 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { /* Apply changes after draining */ if (tcsetattr(fd, TCSADRAIN, &tmp)) - return -errno; + return UV__ERR(errno); tty->mode = mode; return 0; @@ -277,7 +277,7 @@ int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { while (err == -1 && errno == EINTR); if (err == -1) - return -errno; + return UV__ERR(errno); *width = ws.ws_col; *height = ws.ws_row; @@ -355,12 +355,12 @@ int uv_tty_reset_mode(void) { saved_errno = errno; if (!uv_spinlock_trylock(&termios_spinlock)) - return -EBUSY; /* In uv_tty_set_mode(). */ + return UV_EBUSY; /* In uv_tty_set_mode(). */ err = 0; if (orig_termios_fd != -1) if (tcsetattr(orig_termios_fd, TCSANOW, &orig_termios)) - err = -errno; + err = UV__ERR(errno); uv_spinlock_unlock(&termios_spinlock); errno = saved_errno; |