mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: fix timeout limit
* thread.c (ppoll): fix the limit, timeout argument of poll(2) is an int but not a time_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28c389c676
commit
747129ae53
1 changed files with 5 additions and 5 deletions
10
thread.c
10
thread.c
|
@ -3622,15 +3622,15 @@ ppoll(struct pollfd *fds, nfds_t nfds,
|
||||||
if (ts) {
|
if (ts) {
|
||||||
int tmp, tmp2;
|
int tmp, tmp2;
|
||||||
|
|
||||||
if (ts->tv_sec > TIMET_MAX/1000)
|
if (ts->tv_sec > INT_MAX/1000)
|
||||||
timeout_ms = -1;
|
timeout_ms = -1;
|
||||||
else {
|
else {
|
||||||
tmp = ts->tv_sec * 1000;
|
tmp = (int)(ts->tv_sec * 1000);
|
||||||
tmp2 = ts->tv_nsec / (1000 * 1000);
|
tmp2 = (int)(ts->tv_nsec / (1000 * 1000));
|
||||||
if (TIMET_MAX - tmp < tmp2)
|
if (INT_MAX - tmp < tmp2)
|
||||||
timeout_ms = -1;
|
timeout_ms = -1;
|
||||||
else
|
else
|
||||||
timeout_ms = tmp + tmp2;
|
timeout_ms = (int)(tmp + tmp2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue