The following commit has been merged in the master branch:
commit 13dc47e0f9e0df1ea334c916c600b88c1167e985
Author: Stephane Glondu <st...@glondu.net>
Date:   Tue May 7 14:41:52 2013 +0200

    Fix incorrect use of F_SETFL with FD_CLOEXEC (Closes: #696279)

diff --git 
a/debian/patches/ocamlnet-Set-FD_CLOEXEC-correctly-using-F_SETFD-not-.patch 
b/debian/patches/ocamlnet-Set-FD_CLOEXEC-correctly-using-F_SETFD-not-.patch
new file mode 100644
index 0000000..2b0f654
--- /dev/null
+++ b/debian/patches/ocamlnet-Set-FD_CLOEXEC-correctly-using-F_SETFD-not-.patch
@@ -0,0 +1,40 @@
+From: Guillem Jover <guil...@hadrons.org>
+Date: Tue, 18 Dec 2012 18:25:47 +0100
+Subject: ocamlnet: Set FD_CLOEXEC correctly using F_SETFD not F_SETFL
+
+Using that value on F_SETFL is just wrong, and might make the call fail
+on some systems, as it's requesting to set an undetermined flag. For
+example on GNU/* FD_CLOEXEC has value 1, which matches with O_WRONLY.
+
+This might cause the code to at least leak file descriptors, and at worst
+to terminate execution.
+
+Signed-off-by: Stephane Glondu <st...@glondu.net>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696279
+---
+ src/netsys/netsys_c_poll.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/netsys/netsys_c_poll.c b/src/netsys/netsys_c_poll.c
+index d5c4f07..ee88a02 100644
+--- a/src/netsys/netsys_c_poll.c
++++ b/src/netsys/netsys_c_poll.c
+@@ -225,7 +225,7 @@ CAMLprim value netsys_create_event_aggreg(value cancelv)
+ #ifdef USABLE_EPOLL
+     fd = epoll_create(128);
+     if (fd == -1) uerror("epoll_create", Nothing);
+-    code = fcntl(fd, F_SETFL, FD_CLOEXEC);
++    code = fcntl(fd, F_SETFD, FD_CLOEXEC);
+     if (code == -1) {
+       e = errno;
+       close(fd);
+@@ -245,7 +245,7 @@ CAMLprim value netsys_create_event_aggreg(value cancelv)
+           close(fd);
+           unix_error(e, "eventfd", Nothing);
+       };
+-      code = fcntl(cancel_fd, F_SETFL, FD_CLOEXEC);
++      code = fcntl(cancel_fd, F_SETFD, FD_CLOEXEC);
+       if (code == -1) {
+           e = errno;
+           close(fd);
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index ddf7eea..7b00d23 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ Create-installation-directories.patch
 Do-not-install-apache.info-file.patch
 Force-major-version-for-apache-to-2.patch
 Fix-upstream-cleaning-rules.patch
+ocamlnet-Set-FD_CLOEXEC-correctly-using-F_SETFD-not-.patch

-- 
ocamlnet packaging

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to