* dcrt0.cc (dll_crt0_0): Use proper boolean arguments.

* pinfo.cc (pinfo::init): Don't consider MapViewOfFileEx error to be fatal if
exiting.
* pinfo.h (pinfo::init): Eliminate default argument and supply the argument in
the one case that needed it.
This commit is contained in:
Christopher Faylor 2004-07-24 19:18:58 +00:00
parent 8c2defa46c
commit 634d51d94e
4 changed files with 33 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2004-07-24 Christopher Faylor <cgf@timesys.com>
* dcrt0.cc (dll_crt0_0): Use proper boolean arguments.
* pinfo.cc (pinfo::init): Don't consider MapViewOfFileEx error to be
fatal if exiting.
* pinfo.h (pinfo::init): Eliminate default argument and supply the
argument in the one case that needed it.
2004-07-24 Corinna Vinschen <corinna@vinschen.de>
Christopher Faylor <cgf@timesys.com>

View File

@ -665,7 +665,7 @@ dll_crt0_0 ()
{
case _PROC_FORK:
alloc_stack (fork_info);
cygheap_fixup_in_child (0);
cygheap_fixup_in_child (false);
memory_init ();
set_myself (mypid);
close_ppid_handle = !!child_proc_info->pppid_handle;
@ -679,11 +679,11 @@ dll_crt0_0 ()
hexec_proc = spawn_info->hexec_proc;
around:
HANDLE h;
cygheap_fixup_in_child (1);
cygheap_fixup_in_child (true);
memory_init ();
if (!spawn_info->moreinfo->myself_pinfo ||
!DuplicateHandle (hMainProc, spawn_info->moreinfo->myself_pinfo,
hMainProc, &h, 0, 0,
hMainProc, &h, 0, FALSE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
h = NULL;
set_myself (mypid, h);

View File

@ -193,8 +193,25 @@ pinfo::init (pid_t n, DWORD flag, HANDLE in_h)
}
procinfo = (_pinfo *) MapViewOfFileEx (h, access, 0, 0, 0, mapaddr);
if (!procinfo)
api_fatal ("MapViewOfFileEx(%p) failed, %E", h);
if (procinfo)
/* it worked */;
else if (exit_state)
return; /* exiting */
else
{
if (GetLastError () == ERROR_INVALID_HANDLE)
api_fatal ("MapViewOfFileEx(%p, in_h %p) failed, %E", h, in_h);
else
{
debug_printf ("MapViewOfFileEx(%p, in_h %p) failed, %E", h, in_h);
CloseHandle (h);
}
if (i < 9)
continue;
else
return;
}
ProtectHandle1 (h, pinfo_shared_handle);
if ((procinfo->process_state & PID_INITIALIZING) && (flag & PID_NOREDIR)

View File

@ -129,11 +129,11 @@ class pinfo
_pinfo *procinfo;
bool destroy;
public:
void init (pid_t n, DWORD create = 0, HANDLE h = NULL) __attribute__ ((regparm(3)));
void init (pid_t, DWORD, HANDLE = NULL) __attribute__ ((regparm(3)));
pinfo () {}
pinfo (_pinfo *x): procinfo (x) {}
pinfo (pid_t n) {init (n);}
pinfo (pid_t n, int create) {init (n, create);}
pinfo (pid_t n) {init (n, 0);}
pinfo (pid_t n, DWORD flag) {init (n, flag);}
void release ();
~pinfo ()
{