summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-03-19 23:08:29 +0000
committerPete Batard <pbatard@gmail.com>2010-03-19 23:08:29 +0000
commitaf66ec02a932088a84662d389115dbedf9a6e899 (patch)
treee9a70231a45e9504b451ee6a4295ae8233f8875e
parentbb58fb27541972afe2666095e32b4b243ccd87b7 (diff)
downloadlibusb-af66ec02a932088a84662d389115dbedf9a6e899.tar.gz
fixes potential race condition in poll, with pipe fdsr222
-rw-r--r--libusb/os/poll_windows.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c
index 8b2428c..b39a8dc 100644
--- a/libusb/os/poll_windows.c
+++ b/libusb/os/poll_windows.c
@@ -806,6 +806,7 @@ ssize_t usbi_write(int fd, const void *buf, size_t count)
poll_dbg("set pipe event (thread = %08X)", GetCurrentThreadId());
SetEvent(poll_fd[index].overlapped->hEvent);
+ poll_fd[index].overlapped->Internal = STATUS_WAIT_0;
LeaveCriticalSection(&_poll_fd[index].mutex);
return sizeof(unsigned char);
@@ -841,6 +842,7 @@ ssize_t usbi_read(int fd, void *buf, size_t count)
poll_dbg("clr pipe event (thread = %08X)", GetCurrentThreadId());
ResetEvent(poll_fd[index].overlapped->hEvent);
+ poll_fd[index].overlapped->Internal = STATUS_PENDING;
r = sizeof(unsigned char);