diff options
author | Christopher Faylor <me@cgf.cx> | 2000-08-03 03:02:41 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-08-03 03:02:41 +0000 |
commit | 47026c0785a0cd86c05f8255cc34a85c1cf9eced (patch) | |
tree | 10e33e0b681991d98061e7929aed7353f3d20cd5 /winsup/cygwin/spawn.cc | |
parent | 6a2ef321050062b76e8e11b4cade15c1feba54fa (diff) | |
download | cygnal-47026c0785a0cd86c05f8255cc34a85c1cf9eced.tar.gz cygnal-47026c0785a0cd86c05f8255cc34a85c1cf9eced.tar.bz2 cygnal-47026c0785a0cd86c05f8255cc34a85c1cf9eced.zip |
* fork.cc (vfork): Store complete stack frame in vfork_save structure for later
recovery.
* spawn.cc (spawn_guts): Reorganize slightly to consolidate handling when there
is a CreateProcess error.
(_spawnve): Only longjmp back to vfork handling when a process has been
successfuly started.
* winsup.h (vfork_save): Extend to include frame info. Remove obsolete cpplus
conditionals.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r-- | winsup/cygwin/spawn.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 7d3063c31..be35a0b7d 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -607,7 +607,15 @@ skip_arg_parsing: final debugging message [this is a general rule for debugging messages]. */ if (!rc) - __seterrno (); + + if (!rc) + { + if (spr) + ForceCloseHandle (spr); + __seterrno (); + syscall_printf ("CreateProcess failed, %E"); + return -1; + } if (mode == _P_OVERLAY) cygpid = myself->pid; @@ -619,13 +627,6 @@ skip_arg_parsing: rc ? cygpid : (unsigned int) -1, prog_arg, one_line.buf); - if (!rc) - { - if (spr) - ForceCloseHandle (spr); - return -1; - } - MALLOC_CHECK; /* Name the handle similarly to proc_subproc. */ ProtectHandle1 (pi.hProcess, childhProc); @@ -884,7 +885,7 @@ _spawnve (HANDLE hToken, int mode, const char *path, const char *const *argv, case _P_DETACH: subproc_init (); ret = spawn_guts (hToken, path, argv, envp, mode); - if (vf) + if (vf && ret > 0) { vf->pid = ret; longjmp (vf->j, 1); |