diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-07-25 15:23:56 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-07-25 15:23:56 +0000 |
commit | 1d011c0a689efbfcfcb336490af337d7a4a9d320 (patch) | |
tree | 21d9e66a3d42fe7749f132762b550157f9f14c42 /winsup/cygwin/shared.cc | |
parent | 5f853b3fc5277da8cb5ba3ac7406447fe82e65de (diff) | |
download | cygnal-1d011c0a689efbfcfcb336490af337d7a4a9d320.tar.gz cygnal-1d011c0a689efbfcfcb336490af337d7a4a9d320.tar.bz2 cygnal-1d011c0a689efbfcfcb336490af337d7a4a9d320.zip |
* dcrt0.cc (dll_crt0_0): Call malloc_init and user_shared_initialize_1
here in case we're dynamically loaded. Explain why.
(dll_crt0_1): Call user_shared_initialize_1 from here.
* mount.cc (is_native_path): New inline function testing for native
and long Win32 path prefix.
(is_unc_share): Remove long WIn32 path prefix test.
(mount_info::create_root_entry): Use PATH_MAX buffer.
(mount_info::init): Ditto.
(mount_info::add_item): Test for is_native_path as well.
* path.cc (normalize_win32_path): Simplify native path prefix code.
* shared.cc (user_shared_initialize_1): New function taking user
shared initialization code relying on malloc and cygtls.
(user_shared_initialize): Move mountinfo initialization to
user_shared_initialize_1.
* shared_info.h (user_shared_initialize_1): Declare.
* syscalls.cc (seteuid32): Call user_shared_initialize_1 after user
changed.
Diffstat (limited to 'winsup/cygwin/shared.cc')
-rw-r--r-- | winsup/cygwin/shared.cc | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index fca79e487..db24e71f1 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -198,6 +198,24 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size, return shared; } +/* User shared initialization which requires malloc and cygtls stuff has to + go here. */ +void +user_shared_initialize_1 () +{ + if (!user_shared->cb) + { + cygpsid sid (cygheap->user.sid ()); + struct passwd *pw = internal_getpwsid (sid); + /* Correct the user name with what's defined in /etc/passwd before + loading the user fstab file. */ + if (pw) + cygheap->user.set_name (pw->pw_name); + user_shared->mountinfo.init (); /* Initialize the mount table. */ + user_shared->cb = sizeof (*user_shared); + } +} + void user_shared_initialize (bool reinit) { @@ -224,19 +242,8 @@ user_shared_initialize (bool reinit) debug_printf ("user shared version %x", user_shared->version); DWORD sversion = (DWORD) InterlockedExchange ((LONG *) &user_shared->version, USER_VERSION_MAGIC); - /* Initialize the Cygwin per-user shared, if necessary */ - if (!sversion) - { - cygpsid sid (cygheap->user.sid ()); - struct passwd *pw = internal_getpwsid (sid); - /* Correct the user name with what's defined in /etc/passwd before - loading the user fstab file. */ - if (pw) - cygheap->user.set_name (pw->pw_name); - user_shared->mountinfo.init (); /* Initialize the mount table. */ - user_shared->cb = sizeof (*user_shared); - } - else + /* Wait for initialization of the Cygwin per-user shared, if necessary */ + if (sversion) { while (!user_shared->cb) low_priority_sleep (0); // Should be hit only very very rarely |