mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
windows: Always check return value of GetOverlappedResult().
This commit is contained in:
parent
bbe566fe1c
commit
27911925c1
@ -763,7 +763,8 @@ SP_API enum sp_return sp_blocking_write(struct sp_port *port, const void *buf,
|
|||||||
RETURN_INT(count);
|
RETURN_INT(count);
|
||||||
} else if (GetLastError() == ERROR_IO_PENDING) {
|
} else if (GetLastError() == ERROR_IO_PENDING) {
|
||||||
DEBUG("Waiting for write to complete");
|
DEBUG("Waiting for write to complete");
|
||||||
GetOverlappedResult(port->hdl, &port->write_ovl, &bytes_written, TRUE);
|
if (GetOverlappedResult(port->hdl, &port->write_ovl, &bytes_written, TRUE) == 0)
|
||||||
|
RETURN_FAIL("GetOverlappedResult() failed");
|
||||||
DEBUG_FMT("Write completed, %d/%d bytes written", bytes_written, count);
|
DEBUG_FMT("Write completed, %d/%d bytes written", bytes_written, count);
|
||||||
RETURN_INT(bytes_written);
|
RETURN_INT(bytes_written);
|
||||||
} else {
|
} else {
|
||||||
@ -973,7 +974,8 @@ SP_API enum sp_return sp_blocking_read(struct sp_port *port, void *buf,
|
|||||||
bytes_read = count;
|
bytes_read = count;
|
||||||
} else if (GetLastError() == ERROR_IO_PENDING) {
|
} else if (GetLastError() == ERROR_IO_PENDING) {
|
||||||
DEBUG("Waiting for read to complete");
|
DEBUG("Waiting for read to complete");
|
||||||
GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE);
|
if (GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE) == 0)
|
||||||
|
RETURN_FAIL("GetOverlappedResult() failed");
|
||||||
DEBUG_FMT("Read completed, %d/%d bytes read", bytes_read, count);
|
DEBUG_FMT("Read completed, %d/%d bytes read", bytes_read, count);
|
||||||
} else {
|
} else {
|
||||||
RETURN_FAIL("ReadFile() failed");
|
RETURN_FAIL("ReadFile() failed");
|
||||||
|
Loading…
Reference in New Issue
Block a user