summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 11292a16cc..32e77c01e4 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5934,8 +5934,9 @@ rb_w32_dup2(int oldfd, int newfd)
if (oldfd == newfd) return newfd;
ret = dup2(oldfd, newfd);
+ if (ret < 0) return ret;
set_new_std_fd(newfd);
- return ret;
+ return newfd;
}
/* License: Ruby's */