caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* toplevel "I/O error: Bad file descriptor" loop
@ 2006-03-17 19:30 Christophe TROESTLER
  0 siblings, 0 replies; only message in thread
From: Christophe TROESTLER @ 2006-03-17 19:30 UTC (permalink / raw)
  To: OCaml Mailing List

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-17 19:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-17 19:30 toplevel "I/O error: Bad file descriptor" loop Christophe TROESTLER

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).