Package: ocaml / 3.12.1-4

0014-Add-support-for-ENOTSUP.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 file changed, 10 insertions(+), 1 deletion(-)

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)) {
--