summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/ftruncate.c
diff options
context:
space:
mode:
authorJérémie Dimino <jeremie@dimino.org>2014-01-29 09:35:06 +0000
committerJérémie Dimino <jeremie@dimino.org>2014-01-29 09:35:06 +0000
commit67f7b37a7daa24d1de417d79fcb2df03def049d7 (patch)
tree5365a758d1dca7ff7a1180f8565b2806cafd2c14 /otherlibs/unix/ftruncate.c
parentd78c1fe671da816cca9d0d805dc4203269189a86 (diff)
release the lock in ftruncate, fchown, and fchmod
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14425 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/ftruncate.c')
-rw-r--r--otherlibs/unix/ftruncate.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/otherlibs/unix/ftruncate.c b/otherlibs/unix/ftruncate.c
index f539a6450..5b401fde0 100644
--- a/otherlibs/unix/ftruncate.c
+++ b/otherlibs/unix/ftruncate.c
@@ -24,15 +24,22 @@
CAMLprim value unix_ftruncate(value fd, value len)
{
- if (ftruncate(Int_val(fd), Long_val(len)) == -1)
- uerror("ftruncate", Nothing);
+ int result;
+ caml_enter_blocking_section();
+ result = ftruncate(Int_val(fd), Long_val(len));
+ caml_leave_blocking_section();
+ if (result == -1) uerror("ftruncate", Nothing);
return Val_unit;
}
CAMLprim value unix_ftruncate_64(value fd, value len)
{
- if (ftruncate(Int_val(fd), File_offset_val(len)) == -1)
- uerror("ftruncate", Nothing);
+ int result;
+ file_offset ofs = File_offset_val(len);
+ caml_enter_blocking_section();
+ result = ftruncate(Int_val(fd), ofs);
+ caml_leave_blocking_section();
+ if (result == -1) uerror("ftruncate", Nothing);
return Val_unit;
}