From: Martin Ling Date: Sat, 4 Jan 2020 00:13:24 +0000 (+0000) Subject: Move special case for poll() timeout to call site. X-Git-Tag: libserialport-0.1.2~64 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9d1ca7c855fa612d623c44c5ca90ade0b5617a9e;p=libserialport.git Move special case for poll() timeout to call site. --- diff --git a/serialport.c b/serialport.c index bbc6ea6..ad2a6b3 100644 --- a/serialport.c +++ b/serialport.c @@ -210,9 +210,7 @@ static struct timeval *timeout_timeval(struct timeout *timeout) static unsigned int timeout_remaining_ms(struct timeout *timeout) { - if (timeout->ms == 0) - return -1; - else if (timeout->limit_ms && timeout->overflow) + if (timeout->limit_ms && timeout->overflow) return timeout->limit_ms; else return time_as_ms(&timeout->delta); @@ -1625,7 +1623,7 @@ SP_API enum sp_return sp_wait(struct sp_event_set *event_set, break; } - result = poll(pollfds, event_set->count, timeout_remaining_ms(&timeout)); + result = poll(pollfds, event_set->count, timeout_remaining_ms(&timeout) || -1); started = 1; if (result < 0) {