summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--win32/win32.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b6b8206c1..fc661ac7d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 22 11:33:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (dupfd): argument of _osfhnd and so on should not
+ have side effect.
+
Tue Nov 22 11:26:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
* bignum.c (): refix of r33536. Don't change behavior of Bignum#/.
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;