summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-22 02:34:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-22 02:34:00 +0000
commit18b520443cfdf145f3cd7fd22f192c04dc0da9fc (patch)
treee784b16c2601cc124ac1cb4912b85ca3f81a2694 /win32
parent30d762795cf3078764102d9921f875116d5d77a9 (diff)
* win32/win32.c (dupfd): argument of _osfhnd and so on should not
have side effect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/win32/win32.c b/win32/win32.c
index c7f853ce81..89bca5ac4f 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3818,8 +3818,9 @@ dupfd(HANDLE hDup, char flags, int minfd)
close_fds_and_return:
save_errno = errno;
while (filled > 0) {
- _osfhnd(fds[--filled]) = (intptr_t)INVALID_HANDLE_VALUE;
- close(fds[filled]);
+ int fd = fds[--filled];
+ _osfhnd(fd) = (intptr_t)INVALID_HANDLE_VALUE;
+ close(fd);
}
errno = save_errno;