* 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.
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
| 	{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user