summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/fork.c
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2010-04-20 15:47:15 +0000
committerDamien Doligez <damien.doligez-inria.fr>2010-04-20 15:47:15 +0000
commit674da0324d9f659f0fee18264d4e129a6096911d (patch)
tree0efecea6bbc5153427e27503f5c7620dc8120f62 /otherlibs/unix/fork.c
parenta274b01b551be65556263ca47670b39cc97f7dc6 (diff)
PR#4541 make debugger compatible with fork()
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10287 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/fork.c')
-rw-r--r--otherlibs/unix/fork.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/otherlibs/unix/fork.c b/otherlibs/unix/fork.c
index 428137dcb..74ec6294d 100644
--- a/otherlibs/unix/fork.c
+++ b/otherlibs/unix/fork.c
@@ -14,6 +14,7 @@
/* $Id$ */
#include <mlvalues.h>
+#include <debugger.h>
#include "unixsupport.h"
CAMLprim value unix_fork(value unit)
@@ -21,5 +22,9 @@ CAMLprim value unix_fork(value unit)
int ret;
ret = fork();
if (ret == -1) uerror("fork", Nothing);
+ if (caml_debugger_in_use)
+ if ((caml_debugger_fork_mode && ret == 0) ||
+ (!caml_debugger_fork_mode && ret != 0))
+ caml_debugger_cleanup_fork();
return Val_int(ret);
}