From: Martin Ling Date: Wed, 6 May 2015 19:15:46 +0000 (+0100) Subject: windows: restart_wait_if_needed(): Skip buffer check if no bytes read. X-Git-Tag: libserialport-0.1.1~35 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=21ae5ce1970c4a1b27461d65468c2fb4ffa7d726;p=libserialport.git windows: restart_wait_if_needed(): Skip buffer check if no bytes read. --- diff --git a/serialport.c b/serialport.c index 58da1e9..ab263a9 100644 --- a/serialport.c +++ b/serialport.c @@ -923,6 +923,9 @@ static enum sp_return restart_wait_if_needed(struct sp_port *port, unsigned int { int ret, bytes_remaining; + if (bytes_read == 0) + RETURN_OK(); + ret = sp_input_waiting(port); if (ret < 0) @@ -930,7 +933,7 @@ static enum sp_return restart_wait_if_needed(struct sp_port *port, unsigned int bytes_remaining = ret; - if (bytes_read > 0 && bytes_remaining == 0) + if (bytes_remaining == 0) TRY(restart_wait(port)); RETURN_OK();