summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-12 10:09:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-12 10:09:03 +0000
commitf6d77bf56082a9d0b21301384daf8ce9cbfccd4c (patch)
tree978e428f08df5e54f590f5c278e5fba915d8ee31 /win32
parent777c719450311f27d1cf67ef0afc60c953cefe9d (diff)
win32.c: fix dup2 return value
* win32/win32.c (rb_w32_dup2): should return the new fd on success, while msvcrt returns 0 wrongly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-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 */