Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-02-21 06:18:30 +0300
committerChristopher Faylor <me@cgf.cx>2011-02-21 06:18:30 +0300
commit05901e6aee8af35b4d4d24bdefe2d307a86398aa (patch)
treed9203c619707321f69cf82e6a10a4392e399667b
parent734e1c50ff010a2c7aaab6bdcdb3e7756574f7da (diff)
* fhandler.cc (fhandler_base_overlapped::close): Finish any pending I/O before
closing. (fhandler_base_overlapped::wait_overlapped): Defensively zero bytes read. Add more info to debugging output.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler.cc9
2 files changed, 15 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 80e8e401f..c5fa0661a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-20 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * fhandler.cc (fhandler_base_overlapped::close): Finish any pending I/O
+ before closing.
+ (fhandler_base_overlapped::wait_overlapped): Defensively zero bytes
+ read. Add more info to debugging output.
+
2011-02-18 Christopher Faylor <me+cygwin@cgf.cx>
* dcrt0.cc (dll_crt0_1): Add a CYGHEAP_DEBUG conditional for debugging
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 2ff6827be..cea9c1bb0 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1046,6 +1046,12 @@ fhandler_base::close ()
int
fhandler_base_overlapped::close ()
{
+ if (is_nonblocking () && io_pending)
+ {
+ DWORD bytes;
+ set_nonblocking (false);
+ wait_overlapped (1, !!(get_access () & GENERIC_WRITE), &bytes);
+ }
destroy_overlapped ();
return fhandler_base::close ();
}
@@ -1749,6 +1755,7 @@ fhandler_base_overlapped::wait_overlapped (bool inres, bool writing, DWORD *byte
DWORD wfres = WaitForMultipleObjects (n, w4, false, INFINITE);
if (wfres != WAIT_OBJECT_0)
CancelIo (h);
+ *bytes = 0;
BOOL wores = GetOverlappedResult (h, get_overlapped (), bytes, false);
bool signalled = !wores && (wfres == WAIT_OBJECT_0 + 1);
if (signalled)
@@ -1762,7 +1769,7 @@ fhandler_base_overlapped::wait_overlapped (bool inres, bool writing, DWORD *byte
else if (!wores)
{
err = GetLastError ();
- debug_printf ("GetOverLappedResult failed");
+ debug_printf ("GetOverLappedResult failed, bytes %u", *bytes);
}
else
{