diff options
Diffstat (limited to 'otherlibs/unix/link.c')
-rw-r--r-- | otherlibs/unix/link.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/otherlibs/unix/link.c b/otherlibs/unix/link.c index b5051cd96..8110bf583 100644 --- a/otherlibs/unix/link.c +++ b/otherlibs/unix/link.c @@ -12,10 +12,23 @@ /***********************************************************************/ #include <mlvalues.h> +#include <memory.h> +#include <signals.h> #include "unixsupport.h" CAMLprim value unix_link(value path1, value path2) { - if (link(String_val(path1), String_val(path2)) == -1) uerror("link", path2); - return Val_unit; + CAMLparam2(path1, path2); + char * p1; + char * p2; + int ret; + p1 = caml_stat_alloc_string(path1); + p2 = caml_stat_alloc_string(path2); + caml_enter_blocking_section(); + ret = link(p1, p2); + caml_leave_blocking_section(); + caml_stat_free(p1); + caml_stat_free(p2); + if (ret == -1) uerror("link", path2); + CAMLreturn(Val_unit); } |