]> sigrok.org Git - libserialport.git/commitdiff
Move special case for poll() timeout to call site.
authorMartin Ling <redacted>
Sat, 4 Jan 2020 00:13:24 +0000 (00:13 +0000)
committerMartin Ling <redacted>
Mon, 20 Jan 2020 04:31:59 +0000 (04:31 +0000)
serialport.c

index bbc6ea69020baa03496e71bc0c935f15b6ff6309..ad2a6b3c85e5ea5bd7282a754b3bcd7214751ddd 100644 (file)
@@ -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) {