Make a copy of the provided timeout before calling select(2).
This commit is contained in:
parent
8f7834c625
commit
311d12feef
1 changed files with 10 additions and 0 deletions
|
@ -267,6 +267,16 @@ select:
|
||||||
FD_SET (iAbortFd, &rfds);
|
FD_SET (iAbortFd, &rfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some implementations (e.g. Linux) of select(2) will update *timeout.
|
||||||
|
* Make a copy so that it will be updated on these systems,
|
||||||
|
*/
|
||||||
|
struct timeval fixed_timeout;
|
||||||
|
if (timeout) {
|
||||||
|
fixed_timeout = *timeout;
|
||||||
|
timeout = &fixed_timeout;
|
||||||
|
}
|
||||||
|
|
||||||
res = select (MAX(((serial_port_unix *) sp)->fd, iAbortFd) + 1, &rfds, NULL, NULL, timeout);
|
res = select (MAX(((serial_port_unix *) sp)->fd, iAbortFd) + 1, &rfds, NULL, NULL, timeout);
|
||||||
|
|
||||||
if ((res < 0) && (EINTR == errno)) {
|
if ((res < 0) && (EINTR == errno)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue