Browse thread
toplevel "I/O error: Bad file descriptor" loop
- Christophe TROESTLER
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christophe TROESTLER <debian00@t...> |
| Subject: | toplevel "I/O error: Bad file descriptor" loop |
Hi,
I have put together the following simple binding to libmagic:
https://sourceforge.net/projects/ocaml-magic/ Everything works fine
with bytecode and native code compiled programs but, when I try it in
the toplevel to query a non existing file or a special device, I get a
looping "I/O error: Bad file descriptor" message. Example:
# let c = Magic.create [];;
val c : Magic.t = <abstr>
# let m1 = Magic.file c "dllmagic_stub.so";;
val m1 : string =
"ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped"
So far everything is fine.
# let m3 = Magic.file c "/dev/null";;
val m3 : string = "character special (1/3)"
# I/O error: Bad file descriptor
The last message is returned in a loop by the system.
# let m4 = Magic.file c "xxx";;
The same thing happens if "xxx" does not exists.
Has anybody an idea where to look for the cause of this problem? I
looked into libmagic code but the one dealing with file system magic
(fsmagic.c) seems to only perform an unharmful stat/lstat and not
touch stdout.
Best regards,
ChriS