diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3d813be89..25a56e8bc 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2008-08-21 Christopher Faylor + + * fhandler.cc (fhandler_base::wait_overlapped): Reorganize again to + accommodate what appears to be an MSDN hint about not resetting the + overlapped event prior to calling GetOverlappedResult. + 2008-08-20 Corinna Vinschen * path.cc (symlink_info::check_shortcut): If file can't be opened, diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 1db40ac76..49af86f9e 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1691,6 +1691,7 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes) goto err; res = 1; *bytes = 0; + err = 0; } else { @@ -1707,7 +1708,7 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes) w4[n++] = signal_arrived; HANDLE h = writing ? get_output_handle () : get_handle (); DWORD res = WaitForMultipleObjects (n, w4, false, INFINITE); - ResetEvent (get_overlapped ()->hEvent); + err = 0; switch (res) { case WAIT_OBJECT_0: @@ -1738,9 +1739,10 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes) err: __seterrno_from_win_error (err); res = -1; +out: + ResetEvent (get_overlapped ()->hEvent); if (writing && (err == ERROR_NO_DATA || err == ERROR_BROKEN_PIPE)) raise (SIGPIPE); -out: return res; }