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

ruby-changes:39217

From: nobu <ko1@a...>
Date: Mon, 20 Jul 2015 00:21:19 +0900 (JST)
Subject: [ruby-changes:39217] nobu:r51298 (trunk): thread.c: fix timeout limit

nobu	2015-07-20 00:21:00 +0900 (Mon, 20 Jul 2015)

  New Revision: 51298

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

  Log:
    thread.c: fix timeout limit
    
    * thread.c (ppoll): fix the limit, timeout argument of poll(2) is
      an int but not a time_t.

  Modified files:
    trunk/thread.c
Index: thread.c
===================================================================
--- thread.c	(revision 51297)
+++ thread.c	(revision 51298)
@@ -3622,15 +3622,15 @@ ppoll(struct pollfd *fds, nfds_t nfds, https://github.com/ruby/ruby/blob/trunk/thread.c#L3622
     if (ts) {
 	int tmp, tmp2;
 
-	if (ts->tv_sec > TIMET_MAX/1000)
+	if (ts->tv_sec > INT_MAX/1000)
 	    timeout_ms = -1;
 	else {
-	    tmp = ts->tv_sec * 1000;
-	    tmp2 = ts->tv_nsec / (1000 * 1000);
-	    if (TIMET_MAX - tmp < tmp2)
+	    tmp = (int)(ts->tv_sec * 1000);
+	    tmp2 = (int)(ts->tv_nsec / (1000 * 1000));
+	    if (INT_MAX - tmp < tmp2)
 		timeout_ms = -1;
 	    else
-		timeout_ms = tmp + tmp2;
+		timeout_ms = (int)(tmp + tmp2);
 	}
     }
     else

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

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