]> sigrok.org Git - libserialport.git/commitdiff
windows: restart_wait_if_needed(): Skip buffer check if no bytes read.
authorMartin Ling <redacted>
Wed, 6 May 2015 19:15:46 +0000 (20:15 +0100)
committerUwe Hermann <redacted>
Wed, 27 May 2015 09:09:25 +0000 (11:09 +0200)
serialport.c

index 58da1e910bf194b320384f4eb9e4a6ca120d05ce..ab263a95650a51c60ed881d919733378436909bb 100644 (file)
@@ -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();