summaryrefslogtreecommitdiff
path: root/byterun/io.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1998-10-29 15:54:39 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1998-10-29 15:54:39 +0000
commit5cef71a8fcb10a5e668195ffae747ccb0920e81b (patch)
tree4b6449179580fb9c1a8a77980dcbc4ccc7af6b01 /byterun/io.c
parenta812abb06cd38b6c6b88f1da2db9da2ebf3ee542 (diff)
downloadocaml-5cef71a8fcb10a5e668195ffae747ccb0920e81b.tar.gz
Faire sys_error si on accede au file descr d'un channel ferme
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2136 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/io.c')
-rw-r--r--byterun/io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/byterun/io.c b/byterun/io.c
index bd1d86eb84..7c8b6b2e98 100644
--- a/byterun/io.c
+++ b/byterun/io.c
@@ -391,7 +391,9 @@ value caml_open_descriptor(value fd) /* ML */
value channel_descriptor(value vchannel) /* ML */
{
- return Val_long(Channel(vchannel)->fd);
+ int fd = Channel(vchannel)->fd;
+ if (fd == -1) { errno = EBADF; sys_error(NO_ARG); }
+ return Val_int(fd);
}
value caml_close_channel(value vchannel) /* ML */