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:
authorCorinna Vinschen <corinna@vinschen.de>2012-02-02 17:58:20 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-02-02 17:58:20 +0400
commitb2ec6677eda5e44ee3d34df14a60dbee28a0e406 (patch)
tree4a08bc3cf36d0016402f911656c2602f7a54c823 /winsup/cygwin/fhandler_disk_file.cc
parent002a1b18e6857dbc4ef29c0d52ba9cc0106e8de1 (diff)
Fix memory and handle leaks due to fdopendir:
* dir.cc (closedir): Call global close instead of just releasing the fhandler. * fhandler_disk_file.cc (fhandler_disk_file::closedir): Don't close fhandler handle here, rely on global closedir doing the right thing. * fhandler_registry.cc (fhandler_registry::readdir): Also delete d_hash when closing registry key. (fhandler_registry::rewinddir): Ditto. Avoid infinite recursion in VirtualStore under UAC: * fhandler_registry.cc (VIRT_CLASSES_KEY_PREFIX): Define. (VIRT_CLASSES_KEY_SUFFIX): Ditto. (VIRT_CLASSES_KEY): Ditto. (VIRT_CLASSES_LINKTGT): Ditto. (fhandler_registry::exists): Return virt_symlink as file type if this is a Classes key under the VirtualStore. (fhandler_registry::fstat): Handle virt_symlink. (fhandler_registry::readdir): Return DT_LNK as d_type if this is a Classes key under the VirtualStore. (fhandler_registry::fill_filebuf): Handle Classes symlink. Handle user impersonation in /proc/registry access: * autoload.cc (RegOpenUserClassesRoot): Define. (RegOpenCurrentUser): Define. * fhandler_registry.cc (RegOpenUserClassesRoot): Declare function missing in w32api. (RegOpenCurrentUser): Ditto. (fetch_hkey): New function. (fhandler_registry::open): Call fetch_hkey to get root registry key. (open_key): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc15
1 files changed, 1 insertions, 14 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index fe29570b3..a418657e7 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1,7 +1,7 @@
/* fhandler_disk_file.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@@ -2344,21 +2344,8 @@ int
fhandler_disk_file::closedir (DIR *dir)
{
int res = 0;
- NTSTATUS status;
delete d_mounts (dir);
- if (!get_handle ())
- /* ignore */;
- else if (get_handle () == INVALID_HANDLE_VALUE)
- {
- set_errno (EBADF);
- res = -1;
- }
- else if (!NT_SUCCESS (status = NtClose (get_handle ())))
- {
- __seterrno_from_nt_status (status);
- res = -1;
- }
syscall_printf ("%d = closedir(%p, %s)", res, dir, get_name ());
return res;
}