* syscalls.cc (close_all_files): Use cygheap_fdget to manipulate fhandler. Use
debug_only_printf.
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2012-02-02  Christopher Faylor  <me.cygwin2012@cgf.cx> | ||||||
|  |  | ||||||
|  | 	* syscalls.cc (close_all_files): Use cygheap_fdget to manipulate | ||||||
|  | 	fhandler.  Use debug_only_printf. | ||||||
|  |  | ||||||
| 2012-02-02  Corinna Vinschen  <corinna@vinschen.de> | 2012-02-02  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
| 	Fix memory and handle leaks due to fdopendir: | 	Fix memory and handle leaks due to fdopendir: | ||||||
|   | |||||||
| @@ -90,22 +90,22 @@ close_all_files (bool norelease) | |||||||
|  |  | ||||||
|   semaphore::terminate (); |   semaphore::terminate (); | ||||||
|  |  | ||||||
|   fhandler_base *fh; |  | ||||||
|   HANDLE h = NULL; |   HANDLE h = NULL; | ||||||
|  |  | ||||||
|   for (int i = 0; i < (int) cygheap->fdtab.size; i++) |   for (int i = 0; i < (int) cygheap->fdtab.size; i++) | ||||||
|     if ((fh = cygheap->fdtab[i]) != NULL) |  | ||||||
|     { |     { | ||||||
| #ifdef DEBUGGING |       cygheap_fdget cfd (i); | ||||||
| 	debug_printf ("closing fd %d", i); |       if (cfd >= 0) | ||||||
| #endif | 	{ | ||||||
|  | 	  debug_only_printf ("closing fd %d", i); | ||||||
| 	  if (i == 2) | 	  if (i == 2) | ||||||
| 	  DuplicateHandle (GetCurrentProcess (), fh->get_output_handle (), | 	    DuplicateHandle (GetCurrentProcess (), cfd->get_output_handle (), | ||||||
| 			     GetCurrentProcess (), &h, | 			     GetCurrentProcess (), &h, | ||||||
| 			     0, false, DUPLICATE_SAME_ACCESS); | 			     0, false, DUPLICATE_SAME_ACCESS); | ||||||
| 	fh->close_with_arch (); | 	  cfd->close_with_arch (); | ||||||
| 	  if (!norelease) | 	  if (!norelease) | ||||||
| 	  cygheap->fdtab.release (i); | 	    cfd.release (); | ||||||
|  | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   if (!have_execed && cygheap->ctty) |   if (!have_execed && cygheap->ctty) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user