[前][次][番号順一覧][スレッド一覧]

ruby-changes:23407

From: usa <ko1@a...>
Date: Tue, 24 Apr 2012 17:05:49 +0900 (JST)
Subject: [ruby-changes:23407] usa:r35458 (trunk): * win32/win32.c (waitpid): need to check the return value of

usa	2012-04-24 17:05:25 +0900 (Tue, 24 Apr 2012)

  New Revision: 35458

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35458

  Log:
    * win32/win32.c (waitpid): need to check the return value of
      FindChildSlotByHandle() before passing poll_child_status().
      this fixed a SEGV in test-all.  reported by ko1 via IRC.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35457)
+++ ChangeLog	(revision 35458)
@@ -1,3 +1,9 @@
+Tue Apr 24 17:03:51 2012  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (waitpid): need to check the return value of
+	  FindChildSlotByHandle() before passing poll_child_status().
+	  this fixed a SEGV in test-all.  reported by ko1 via IRC.
+
 Tue Apr 24 16:04:39 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (parser_yylex): EXPR_BEG by keywords is a start point of
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 35457)
+++ win32/win32.c	(revision 35458)
@@ -3921,6 +3921,7 @@
 	int count = 0;
 	int ret;
 	HANDLE events[MAXCHILDNUM];
+	struct ChildRecord* cause;
 
 	FOREACH_CHILD(child) {
 	    if (!child->pid || child->pid < 0) continue;
@@ -3942,7 +3943,12 @@
 	    return -1;
 	}
 
-	return poll_child_status(FindChildSlotByHandle(events[ret]), stat_loc);
+	cause = FindChildSlotByHandle(events[ret]);
+	if (!cause) {
+	    errno = ECHILD;
+	    return -1;
+	}
+	return poll_child_status(cause, stat_loc);
     }
     else {
 	struct ChildRecord* child = FindChildSlot(pid);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]