win32: fix race condition
As pointed out by DavidHowlett in #27, there can be a race condition where
ReadFile returns false but the operation is completed before GetLastError
is called, therefore also allow ERROR_SUCCESS (0) to be OK.
Also as suggested, rename flag.
diff --git a/serial/win32.py b/serial/win32.py
index c8dd3e3..0ad9b6d 100644
--- a/serial/win32.py
+++ b/serial/win32.py
@@ -210,6 +210,7 @@
EV_DSR = 16 # Variable c_int
MAXDWORD = 4294967295 # Variable c_uint
EV_RLSD = 32 # Variable c_int
+ERROR_SUCCESS = 0
ERROR_IO_PENDING = 997 # Variable c_long
MS_CTS_ON = 16 # Variable c_ulong
EV_EVENT1 = 2048 # Variable c_int