diff options
Diffstat (limited to 'otherlibs/unix/chroot.c')
-rw-r--r-- | otherlibs/unix/chroot.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/otherlibs/unix/chroot.c b/otherlibs/unix/chroot.c index 02a46aedc..7c9517c11 100644 --- a/otherlibs/unix/chroot.c +++ b/otherlibs/unix/chroot.c @@ -12,12 +12,20 @@ /***********************************************************************/ #include <mlvalues.h> +#include <memory.h> +#include <signals.h> #include "unixsupport.h" CAMLprim value unix_chroot(value path) { + CAMLparam1(path); + char * p; int ret; - ret = chroot(String_val(path)); + p = caml_stat_alloc_string(path); + caml_enter_blocking_section(); + ret = chroot(p); + caml_leave_blocking_section(); + caml_stat_free(p); if (ret == -1) uerror("chroot", path); - return Val_unit; + CAMLreturn(Val_unit); } |