diff options
| author | Xavier Leroy <xavier.leroy@inria.fr> | 2011-05-12 15:12:14 +0000 |
|---|---|---|
| committer | Xavier Leroy <xavier.leroy@inria.fr> | 2011-05-12 15:12:14 +0000 |
| commit | 7d0c29a444d49adfee4920ff456e84288dc77b55 (patch) | |
| tree | e0f372583f9153c4c419f50a0253fe92cdc08500 | |
| parent | efcf3599c7a81c562eb32e5b3c2dfc72b900308c (diff) | |
| download | ocaml-7d0c29a444d49adfee4920ff456e84288dc77b55.tar.gz | |
PR#5069
git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.12@11038 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | Changes | 1 | ||||
| -rw-r--r-- | byterun/sys.c | 8 |
2 files changed, 6 insertions, 3 deletions
@@ -14,6 +14,7 @@ Bug fixes: - PR#4967: ocamlbuild passes wrong switches to ocamldep through menhir - PR#4972: mkcamlp4 does not include 'dynlink.cma' - PR#5039: ocamlbuild should use '-linkpkg' only when linking programs +- PR#5069: fcntl() in caml_sys_open may block, do it within blocking section - PR#5071, PR#5129, PR#5134: inconsistencies between camlp4 and camlp4* binaries - PR#5080, PR#5104: regression in type constructor handling by camlp4 - PR#5095: ocamlbuild ignores some tags when building bytecode objects diff --git a/byterun/sys.c b/byterun/sys.c index bbc0e605f4..9928910f73 100644 --- a/byterun/sys.c +++ b/byterun/sys.c @@ -138,12 +138,14 @@ CAMLprim value caml_sys_open(value path, value vflags, value vperm) /* open on a named FIFO can block (PR#1533) */ caml_enter_blocking_section(); fd = open(p, flags, perm); + /* fcntl on a fd can block (PR#5069)*/ +#if defined(F_SETFD) && defined(FD_CLOEXEC) + if (fd != -1) + fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif caml_leave_blocking_section(); caml_stat_free(p); if (fd == -1) caml_sys_error(path); -#if defined(F_SETFD) && defined(FD_CLOEXEC) - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif CAMLreturn(Val_long(fd)); } |
