* cygheap.cc (_cmalloc): Use correct constants for size calculation.
* dcrt0.cc (dll_crt0_1): Move uid initialization earlier. * fork.cc (fork_parent): Move cygheap_setup_in_child to just prior to CreateProcess so that all contents of cygheap are copied. * spawn.cc (spawn_guts): Ditto.
This commit is contained in:
parent
c9fbce2641
commit
16828fc5d4
|
@ -1,3 +1,11 @@
|
||||||
|
Wed 18 Jul 2001 01:00:47 PM EDT Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* cygheap.cc (_cmalloc): Use correct constants for size calculation.
|
||||||
|
* dcrt0.cc (dll_crt0_1): Move uid initialization earlier.
|
||||||
|
* fork.cc (fork_parent): Move cygheap_setup_in_child to just prior to
|
||||||
|
CreateProcess so that all contents of cygheap are copied.
|
||||||
|
* spawn.cc (spawn_guts): Ditto.
|
||||||
|
|
||||||
Wed 18 Jul 2001 12:54:17 Corinna Vinschen <corinna@vinschen.de>
|
Wed 18 Jul 2001 12:54:17 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* security.cc (get_user_groups): Call Net function with NULL server
|
* security.cc (get_user_groups): Call Net function with NULL server
|
||||||
|
|
|
@ -167,10 +167,11 @@ static void *__stdcall
|
||||||
_cmalloc (int size)
|
_cmalloc (int size)
|
||||||
{
|
{
|
||||||
_cmalloc_entry *rvc;
|
_cmalloc_entry *rvc;
|
||||||
int b, sz;
|
unsigned b, sz;
|
||||||
|
|
||||||
/* Calculate "bit bucket" and size as a power of two. */
|
/* Calculate "bit bucket" and size as a power of two. */
|
||||||
for (b = 3, sz = 8; sz && sz < (size + 4); b++, sz <<= 1)
|
for (b = 3, sz = 8; sz && sz < (size + sizeof (_cmalloc_entry));
|
||||||
|
b++, sz <<= 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cygheap_protect->acquire ();
|
cygheap_protect->acquire ();
|
||||||
|
|
|
@ -695,6 +695,7 @@ dll_crt0_1 ()
|
||||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
|
||||||
h = NULL;
|
h = NULL;
|
||||||
set_myself (mypid, h);
|
set_myself (mypid, h);
|
||||||
|
myself->uid = spawn_info->moreinfo->uid;
|
||||||
__argc = spawn_info->moreinfo->argc;
|
__argc = spawn_info->moreinfo->argc;
|
||||||
__argv = spawn_info->moreinfo->argv;
|
__argv = spawn_info->moreinfo->argv;
|
||||||
envp = spawn_info->moreinfo->envp;
|
envp = spawn_info->moreinfo->envp;
|
||||||
|
@ -709,7 +710,6 @@ dll_crt0_1 ()
|
||||||
}
|
}
|
||||||
if (child_proc_info->subproc_ready)
|
if (child_proc_info->subproc_ready)
|
||||||
ProtectHandle (child_proc_info->subproc_ready);
|
ProtectHandle (child_proc_info->subproc_ready);
|
||||||
myself->uid = spawn_info->moreinfo->uid;
|
|
||||||
if (myself->uid == USHRT_MAX)
|
if (myself->uid == USHRT_MAX)
|
||||||
cygheap->user.set_sid (NULL);
|
cygheap->user.set_sid (NULL);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -442,7 +442,6 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
|
||||||
RevertToSelf ();
|
RevertToSelf ();
|
||||||
|
|
||||||
ch.parent = hParent;
|
ch.parent = hParent;
|
||||||
cygheap_setup_for_child (&ch);
|
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
if (npid_max)
|
if (npid_max)
|
||||||
{
|
{
|
||||||
|
@ -464,6 +463,7 @@ out:
|
||||||
char sa_buf[1024];
|
char sa_buf[1024];
|
||||||
syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)",
|
syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)",
|
||||||
myself->progname, myself->progname, c_flags, &si, &pi);
|
myself->progname, myself->progname, c_flags, &si, &pi);
|
||||||
|
cygheap_setup_for_child (&ch);
|
||||||
rc = CreateProcess (myself->progname, /* image to run */
|
rc = CreateProcess (myself->progname, /* image to run */
|
||||||
myself->progname, /* what we send in arg0 */
|
myself->progname, /* what we send in arg0 */
|
||||||
allow_ntsec ? sec_user (sa_buf) : &sec_none_nih,
|
allow_ntsec ? sec_user (sa_buf) : &sec_none_nih,
|
||||||
|
|
|
@ -542,7 +542,8 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv,
|
||||||
*c++ = cstrdup1 (*e++);
|
*c++ = cstrdup1 (*e++);
|
||||||
*c = NULL;
|
*c = NULL;
|
||||||
if (mode != _P_OVERLAY ||
|
if (mode != _P_OVERLAY ||
|
||||||
!DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, &ciresrv.moreinfo->myself_pinfo, 0,
|
!DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc,
|
||||||
|
&ciresrv.moreinfo->myself_pinfo, 0,
|
||||||
TRUE, DUPLICATE_SAME_ACCESS))
|
TRUE, DUPLICATE_SAME_ACCESS))
|
||||||
ciresrv.moreinfo->myself_pinfo = NULL;
|
ciresrv.moreinfo->myself_pinfo = NULL;
|
||||||
|
|
||||||
|
@ -578,8 +579,6 @@ skip_arg_parsing:
|
||||||
else
|
else
|
||||||
envblock = winenv (envp, 0);
|
envblock = winenv (envp, 0);
|
||||||
|
|
||||||
cygheap_setup_for_child (&ciresrv);
|
|
||||||
|
|
||||||
/* Preallocated buffer for `sec_user' call */
|
/* Preallocated buffer for `sec_user' call */
|
||||||
char sa_buf[1024];
|
char sa_buf[1024];
|
||||||
|
|
||||||
|
@ -598,6 +597,7 @@ skip_arg_parsing:
|
||||||
/* FIXME: This leaks a handle in the CreateProcessAsUser case since the
|
/* FIXME: This leaks a handle in the CreateProcessAsUser case since the
|
||||||
child process doesn't know about cygwin_mount_h. */
|
child process doesn't know about cygwin_mount_h. */
|
||||||
ciresrv.mount_h = cygwin_mount_h;
|
ciresrv.mount_h = cygwin_mount_h;
|
||||||
|
cygheap_setup_for_child (&ciresrv);
|
||||||
rc = CreateProcess (runpath, /* image name - with full path */
|
rc = CreateProcess (runpath, /* image name - with full path */
|
||||||
one_line.buf, /* what was passed to exec */
|
one_line.buf, /* what was passed to exec */
|
||||||
/* process security attrs */
|
/* process security attrs */
|
||||||
|
@ -652,6 +652,7 @@ skip_arg_parsing:
|
||||||
strcat (wstname, dskname);
|
strcat (wstname, dskname);
|
||||||
si.lpDesktop = wstname;
|
si.lpDesktop = wstname;
|
||||||
|
|
||||||
|
cygheap_setup_for_child (&ciresrv);
|
||||||
rc = CreateProcessAsUser (hToken,
|
rc = CreateProcessAsUser (hToken,
|
||||||
runpath, /* image name - with full path */
|
runpath, /* image name - with full path */
|
||||||
one_line.buf, /* what was passed to exec */
|
one_line.buf, /* what was passed to exec */
|
||||||
|
|
Loading…
Reference in New Issue