summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-04 14:31:37 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-04 14:31:37 +0000
commitd291c56e63591b58411e80f9c106c65ca9aa3ca2 (patch)
treed2030bf21cf276c5fa29366de12f8ad4c5aea716 /win32
parentbd9befd99e08cb093ff46e26a1e706173bb29115 (diff)
* win32/win32.c (waitpid): fix bug of checking child slot.
* win32/win32.c (FindChildSlotByHandle): new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index f2129afac8..5829e86d68 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -533,6 +533,18 @@ FindChildSlot(rb_pid_t pid)
return NULL;
}
+static struct ChildRecord *
+FindChildSlotByHandle(HANDLE h)
+{
+
+ FOREACH_CHILD(child) {
+ if (child->hProcess == h) {
+ return child;
+ }
+ } END_FOREACH_CHILD;
+ return NULL;
+}
+
static void
CloseChildHandle(struct ChildRecord *child)
{
@@ -3062,7 +3074,7 @@ waitpid(rb_pid_t pid, int *stat_loc, int options)
return -1;
}
- return poll_child_status(ChildRecord + ret, stat_loc);
+ return poll_child_status(FindChildSlotByHandle(events[ret]), stat_loc);
}
else {
struct ChildRecord* child = FindChildSlot(pid);