fix missing error handling in windows preadv/pwritev emulation

This commit is contained in:
arvidn 2016-01-13 00:49:17 -05:00
parent 5ca75a0f0f
commit 4a28e95ce0
1 changed files with 20 additions and 4 deletions

View File

@ -194,11 +194,19 @@ namespace
} }
} }
WaitForMultipleObjects(num_bufs, h, TRUE, INFINITE); if (WaitForMultipleObjects(num_bufs, h, TRUE, INFINITE) == WAIT_FAILED)
{
ret = -1;
break;
}
for (int i = 0; i < num_bufs; ++i) for (int i = 0; i < num_bufs; ++i)
{ {
WaitForSingleObject(ol[i].hEvent, INFINITE); if (WaitForSingleObject(ol[i].hEvent, INFINITE) == WAIT_FAILED)
{
ret = -1;
break;
}
DWORD num_read; DWORD num_read;
if (GetOverlappedResult(fd, &ol[i], &num_read, FALSE) == FALSE) if (GetOverlappedResult(fd, &ol[i], &num_read, FALSE) == FALSE)
{ {
@ -256,11 +264,19 @@ done:
} }
} }
WaitForMultipleObjects(num_bufs, h, TRUE, INFINITE); if (WaitForMultipleObjects(num_bufs, h, TRUE, INFINITE) == WAIT_FAILED)
{
ret = -1;
break;
}
for (int i = 0; i < num_bufs; ++i) for (int i = 0; i < num_bufs; ++i)
{ {
WaitForSingleObject(ol[i].hEvent, INFINITE); if (WaitForSingleObject(ol[i].hEvent, INFINITE) == WAIT_FAILED)
{
ret = -1;
break;
}
DWORD num_written; DWORD num_written;
if (GetOverlappedResult(fd, &ol[i], &num_written, FALSE) == FALSE) if (GetOverlappedResult(fd, &ol[i], &num_written, FALSE) == FALSE)
{ {