]> sigrok.org Git - libserialport.git/commitdiff
Check return value of GetOverlappedResult().
authorMartin Ling <redacted>
Sat, 7 Dec 2013 16:50:27 +0000 (16:50 +0000)
committerMartin Ling <redacted>
Sat, 7 Dec 2013 17:09:06 +0000 (17:09 +0000)
serialport.c

index e42e757d771f48615a3de5b1477c860d3f45faec..b7dd66a3bfad1220d319a75fb141cae588ee47e7 100644 (file)
@@ -1155,7 +1155,8 @@ enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf, size_t count
                RETURN_FAIL("ReadFile() failed");
 
        /* Get number of bytes read. */
-       GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE);
+       if (GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE) == 0)
+               RETURN_FAIL("GetOverlappedResult() failed");
 
        RETURN_VALUE("%d", bytes_read);
 #else