diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 927147cf9..f28edfa0e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2003-09-25 Christopher Faylor + + * fork.cc (fork_parent): Detect failed pinfo constructor. + * spawn.cc (spawn_guts): Don't overwrite ENOMEM errno on failed pinfo + constructor. + 2003-09-25 Christopher Faylor * spawn.cc (spawnve): Remove vfork short circuit and let caller deal diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 2fe73667a..00f296bae 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -500,6 +500,13 @@ fork_parent (HANDLE& hParent, dll *&first_dll, #else pinfo forked (cygwin_pid (pi.dwProcessId), 1); #endif + if (!forked) + { + syscall_printf ("pinfo failed"); + if (get_errno () != ENOMEM) + set_errno (EAGAIN); + goto cleanup; + } /* Initialize things that are done later in dll_crt0_1 that aren't done for the forkee. */ diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index d205c26bc..30d1dd749 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -792,7 +792,8 @@ spawn_guts (const char * prog_arg, const char *const *argv, if (!child) { syscall_printf ("pinfo failed"); - set_errno (EAGAIN); + if (get_errno () != ENOMEM) + set_errno (EAGAIN); res = -1; goto out; }