diff -Naur -x '*.orig' -x '*~' ocaml-mad-0.3.6/src/mad_stubs.c ocaml-mad-0.3.6-openfile/src/mad_stubs.c --- ocaml-mad-0.3.6/src/mad_stubs.c 2009-10-12 11:07:26.000000000 +0200 +++ ocaml-mad-0.3.6-openfile/src/mad_stubs.c 2010-01-25 21:34:39.000000000 +0100 @@ -159,6 +159,11 @@ CAMLlocal1(block); madfile_t *mf; FILE *fd = fopen(String_val(file), "r"); + if (fd == NULL) { + char err_buf[256]; + snprintf(err_buf, 256, "Error: couldn't open file \"%s\"", String_val(file)); + caml_failwith(err_buf); + } if (!fd) caml_raise_with_arg(*caml_named_value("mad_exn_openfile_error"),