* cygheap.cc (cygheap_fixup_in_child): Drop call to set_dll_dir.

(init_cygheap::init_installation_root): Set installation_dir_len.
	(setup_cygheap): Drop call to set_dll_dir.
	* cygheap.h (struct init_cygheap): Add installation_dir_len member.
	(init_cygheap::set_dll_dir): Remove.
	* environ.cc (win_env::add_cache): Use stpcpy for speed.
	(posify_maybe): Use tmp_pathbuf buffer instead of stack.
	(raise_envblock): New function to resize Windows environment block.
	(build_env): Fix indentation.  Call raise_envblock function.  Check if
	$PATH exists and is non-empty.  If not, add PATH variable with Cygwin
	installation directory as content to Windows environment.  Explain why.

	* uinfo.cc (cygheap_pwdgrp::_nss_init): Fill UNICODE_STRING members
	on the fly.  Drop call to RtlInitUnicodeString.
	(pwdgrp::check_file): Ditto.
This commit is contained in:
Corinna Vinschen
2014-10-27 11:33:53 +00:00
parent 41425f2dda
commit f7cb52eec7
6 changed files with 87 additions and 53 deletions

View File

@ -752,10 +752,11 @@ cygheap_pwdgrp::_nss_init ()
char *buf = tp.c_get ();
PCWSTR rel_path = L"\\etc\\nsswitch.conf";
path.Buffer = (PWCHAR) alloca ((wcslen (cygheap->installation_root)
+ wcslen (rel_path) + 1) * sizeof (WCHAR));
path.Length = (wcslen (cygheap->installation_root) + wcslen (rel_path))
* sizeof (WCHAR);
path.MaximumLength = path.Length + sizeof (WCHAR);
path.Buffer = (PWCHAR) alloca (path.MaximumLength);
wcpcpy (wcpcpy (path.Buffer, cygheap->installation_root), rel_path);
RtlInitUnicodeString (&path, path.Buffer);
InitializeObjectAttributes (&attr, &path, OBJ_CASE_INSENSITIVE,
NULL, NULL);
if (rl.init (&attr, buf, NT_MAX_PATH))
@ -1045,12 +1046,11 @@ pwdgrp::check_file ()
if (!path.Buffer)
{
PCWSTR rel_path = is_group () ? L"\\etc\\group" : L"\\etc\\passwd";
path.Buffer = (PWCHAR) cmalloc_abort (HEAP_BUF,
(wcslen (cygheap->installation_root)
+ wcslen (rel_path) + 1)
* sizeof (WCHAR));
path.Length = (wcslen (cygheap->installation_root) + wcslen (rel_path))
* sizeof (WCHAR);
path.MaximumLength = path.Length + sizeof (WCHAR);
path.Buffer = (PWCHAR) cmalloc_abort (HEAP_BUF, path.MaximumLength);
wcpcpy (wcpcpy (path.Buffer, cygheap->installation_root), rel_path);
RtlInitUnicodeString (&path, path.Buffer);
InitializeObjectAttributes (&attr, &path, OBJ_CASE_INSENSITIVE,
NULL, NULL);
}