From: Martin Ling Date: Sat, 7 Dec 2013 16:50:27 +0000 (+0000) Subject: Check return value of GetOverlappedResult(). X-Git-Tag: libserialport-0.1.0~26 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1622ef60b032522edfecca46bd23ec1bf4b0ee64;p=libserialport.git Check return value of GetOverlappedResult(). --- diff --git a/serialport.c b/serialport.c index e42e757..b7dd66a 100644 --- a/serialport.c +++ b/serialport.c @@ -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