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