From 15140cebe1b2221ede19d6a31150e9597edc6ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 20 Mar 2014 15:50:43 +0100 Subject: [PATCH] unix: fix handling uv__open_cloexec failure --- src/unix/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/tty.c b/src/unix/tty.c index c7ed101a..4df8af13 100644 --- a/src/unix/tty.c +++ b/src/unix/tty.c @@ -56,8 +56,8 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { if (isatty(fd)) { newfd = uv__open_cloexec("/dev/tty", O_RDWR); - if (newfd == -1) - return -errno; + if (newfd < 0) + return newfd; /* returned value is the error */ r = uv__dup2_cloexec(newfd, fd); if (r < 0 && r != -EINVAL) {