Add support for ENOTSUP (Closes: #646372)
authorStephane Glondu <steph@glondu.net>
Tue, 1 Nov 2011 12:51:52 +0000 (13:51 +0100)
committerStephane Glondu <steph@glondu.net>
Tue, 1 Nov 2011 12:54:05 +0000 (13:54 +0100)
debian/patches/0014-Add-support-for-ENOTSUP.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0014-Add-support-for-ENOTSUP.patch b/debian/patches/0014-Add-support-for-ENOTSUP.patch
new file mode 100644 (file)
index 0000000..e2f031f
--- /dev/null
@@ -0,0 +1,49 @@
+From: Samuel Thibault <sthibault@debian.org>
+Date: Tue, 1 Nov 2011 13:48:38 +0100
+Subject: Add support for ENOTSUP
+
+On some systems such as Solaris or GNU/Hurd, ENOTSUP and EOPNOSUPP do
+not have the same value, but ocaml code only deals with EOPNOSUPP, and
+thus ocaml applications only handle the EOPNOSUPP case. The attached
+patch fixes it by making ocaml convert ENOTSUP errors into EOPNOSUPP
+errors.
+
+This patch fixes omake build on hurd-i386.
+
+Bug: http://caml.inria.fr/mantis/view.php?id=5382
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646372
+Signed-off-by: Stephane Glondu <steph@glondu.net>
+---
+ otherlibs/unix/unixsupport.c |   11 ++++++++++-
+ 1 files changed, 10 insertions(+), 1 deletions(-)
+
+diff --git a/otherlibs/unix/unixsupport.c b/otherlibs/unix/unixsupport.c
+index a471f9e..db5912e 100644
+--- a/otherlibs/unix/unixsupport.c
++++ b/otherlibs/unix/unixsupport.c
+@@ -165,7 +165,11 @@
+ #define ESOCKTNOSUPPORT (-1)
+ #endif
+ #ifndef EOPNOTSUPP
+-#define EOPNOTSUPP (-1)
++#  ifdef ENOTSUP
++#    define EOPNOTSUPP ENOTSUP
++#  else
++#    define EOPNOTSUPP (-1)
++#  endif
+ #endif
+ #ifndef EPFNOSUPPORT
+ #define EPFNOSUPPORT (-1)
+@@ -252,6 +256,11 @@ value unix_error_of_code (int errcode)
+   int errconstr;
+   value err;
++#if defined(ENOTSUP) && (EOPNOTSUPP != ENOTSUP)
++  if (errcode == ENOTSUP)
++    errcode = EOPNOTSUPP;
++#endif
++
+   errconstr =
+       cst_to_constr(errcode, error_table, sizeof(error_table)/sizeof(int), -1);
+   if (errconstr == Val_int(-1)) {
+-- 
index 8b210e3f65f8504844fda275390bdc7a42c46db5..92b52ed54080122d07ee7055304beffa0228dc5a 100644 (file)
@@ -11,3 +11,4 @@
 0011-Embed-bytecode-in-C-object-when-using-custom.patch
 0012-Make-objinfo-show-force_link-and-ccobjs-ccopts-when-.patch
 0013-ocamlopt-arm-add-.type-directive-for-code-symbols.patch
+0014-Add-support-for-ENOTSUP.patch