summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fork.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r--winsup/cygwin/fork.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 81ed6e21b..e566bf0e6 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -687,8 +687,7 @@ get_vfork_val ()
}
#endif
-extern "C"
-int
+extern "C" int
vfork ()
{
#ifndef NEWVFORK
@@ -711,9 +710,11 @@ vfork ()
for (pp = (char **)vf->frame, esp = vf->vfork_esp;
esp <= vf->vfork_ebp + 2; pp++, esp++)
*pp = *esp;
+ vf->ctty = myself->ctty;
+ vf->sid = myself->sid;
+ vf->pgid = myself->pgid;
int res = cygheap->fdtab.vfork_child_dup () ? 0 : -1;
debug_printf ("%d = vfork()", res);
- debug_printf ("exiting vfork, res %d", res);
return res;
}
@@ -726,9 +727,13 @@ vfork ()
thisframe.init (mainthread);
cygheap->fdtab.vfork_parent_restore ();
+ myself->ctty = vf->ctty;
+ myself->sid = vf->sid;
+ myself->pgid = vf->pgid;
+
if (vf->pid < 0)
{
- int exitval = -vf->pid;
+ int exitval = vf->exitval;
vf->pid = 0;
if ((vf->pid = fork ()) == 0)
exit (exitval);