OSDN Git Service

* cygheap.h (cygheap_user::cygheap_user): Initialize token to
authorcorinna <corinna>
Mon, 4 Jun 2001 14:29:54 +0000 (14:29 +0000)
committercorinna <corinna>
Mon, 4 Jun 2001 14:29:54 +0000 (14:29 +0000)
        INVALID_HANDLE_VALUE.
        * uinfo.cc (uinfo_init): Close token handle if needed.

winsup/cygwin/ChangeLog
winsup/cygwin/cygheap.h
winsup/cygwin/uinfo.cc

index 820c41f..c4cf3bb 100644 (file)
@@ -1,3 +1,9 @@
+Mon Jun  4 16:21:00 2001  Corinna Vinschen <corinna@vinschen.de>
+
+       * cygheap.h (cygheap_user::cygheap_user): Initialize token to
+       INVALID_HANDLE_VALUE.
+       * uinfo.cc (uinfo_init): Close token handle if needed.
+
 Sun Jun  3 20:52:13 2001  Christopher Faylor <cgf@cygnus.com>
 
        * path.cc (normalize_posix_path): Revert ..  check removed by previous
index 6348590..a5c823f 100644 (file)
@@ -107,7 +107,8 @@ public:
   HANDLE token;
   BOOL   impersonated;
 
-  cygheap_user () : pname (NULL), plogsrv (NULL), pdomain (NULL), psid (NULL) {}
+  cygheap_user () : pname (NULL), plogsrv (NULL), pdomain (NULL),
+                   psid (NULL), token (INVALID_HANDLE_VALUE) {}
   ~cygheap_user ();
 
   void set_name (const char *new_name);
index b024396..a3b734e 100644 (file)
@@ -161,6 +161,8 @@ uinfo_init ()
      Setting `impersonated' to TRUE seems to be wrong but it
      isn't. Impersonated is thought as "Current User and `token'
      are coincident". See seteuid() for the mechanism behind that. */
+  if (cygheap->user.token != INVALID_HANDLE_VALUE)
+    CloseHandle (cygheap->user.token);
   cygheap->user.token = INVALID_HANDLE_VALUE;
   cygheap->user.impersonated = TRUE;