diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e995ca0e2..cc32b8792 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4 +1,11 @@ -2002-05-24 Christopher January +2002-05-05 Pierre Humblet + + * spawn.cc (spawn_guts): Move call to set_process_privilege() + to load_registry_hive(). + * registry.cc (load_registry_hive): ditto. + * fork.cc (fork_parent): Call sec_user_nih() only once. + +2002-05-04 Christopher January * path.h (path_conv::path_conv): Initialise normalized_path to NULL. diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 66f2d220f..b0c893dce 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -466,6 +466,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, #endif char sa_buf[1024]; + PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf); syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)", myself->progname, myself->progname, c_flags, &si, &pi); __malloc_lock (_reent_clib ()); @@ -473,8 +474,8 @@ fork_parent (HANDLE& hParent, dll *&first_dll, newheap = cygheap_setup_for_child (&ch,cygheap->fdtab.need_fixup_before ()); rc = CreateProcess (myself->progname, /* image to run */ myself->progname, /* what we send in arg0 */ - sec_user_nih (sa_buf), - sec_user_nih (sa_buf), + sec_attribs, + sec_attribs, TRUE, /* inherit handles from parent */ c_flags, NULL, /* environment filled in later */ diff --git a/winsup/cygwin/registry.cc b/winsup/cygwin/registry.cc index 3ed1a80bb..4d2bb2b5a 100644 --- a/winsup/cygwin/registry.cc +++ b/winsup/cygwin/registry.cc @@ -235,12 +235,13 @@ load_registry_hive (PSID psid) /* Check if user hive is already loaded. */ cygsid csid (psid); csid.string (sid); - if (!RegOpenKeyExA (HKEY_USERS, csid.string (sid), 0, KEY_READ, &hkey)) + if (!RegOpenKeyExA (HKEY_USERS, sid, 0, KEY_READ, &hkey)) { debug_printf ("User registry hive for %s already exists", sid); RegCloseKey (hkey); return; } + set_process_privilege (SE_RESTORE_NAME); if (get_registry_hive_path (psid, path)) { strcat (path, "\\NTUSER.DAT"); diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 902066524..3da30de85 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -665,13 +665,6 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv, && cygheap->user.token != INVALID_HANDLE_VALUE) RevertToSelf (); - static BOOL first_time = TRUE; - if (first_time) - { - set_process_privilege (SE_RESTORE_NAME); - first_time = FALSE; - } - /* Load users registry hive. */ load_registry_hive (sid);