From bb2ee61500fe1a537d3a77f2c3bbb96ffeb244ac Mon Sep 17 00:00:00 2001
From: Zero King <l2dy@macports.org>
Date: Fri, 10 Mar 2017 06:47:10 +0000
Subject: [PATCH] miredo: fix crash
---
net/miredo/Portfile | 3 ++-
net/miredo/files/patch-compat-closefrom.c.diff | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 net/miredo/files/patch-compat-closefrom.c.diff
diff --git a/net/miredo/Portfile b/net/miredo/Portfile
index 562fbcac31..bab16ca58c 100644
a
|
b
|
PortSystem 1.0 |
4 | 4 | |
5 | 5 | name miredo |
6 | 6 | version 1.2.6 |
| 7 | revision 1 |
7 | 8 | maintainers {l2dy @l2dy} openmaintainer |
8 | 9 | |
9 | 10 | categories net |
… |
… |
use_xz yes |
24 | 25 | checksums rmd160 b02b96f233df2211f45c0dad981f0a5ab6aa1789 \ |
25 | 26 | sha256 fa26d2f4a405415833669e2e2e22677b225d8f83600844645d5683535ea43149 |
26 | 27 | |
27 | | patchfiles patch-nosignal.diff |
| 28 | patchfiles patch-nosignal.diff patch-compat-closefrom.c.diff |
28 | 29 | use_parallel_build no |
29 | 30 | |
30 | 31 | depends_lib-append port:judy port:tuntaposx |
diff --git a/net/miredo/files/patch-compat-closefrom.c.diff b/net/miredo/files/patch-compat-closefrom.c.diff
new file mode 100644
index 0000000000..06ef9873e4
-
|
+
|
|
| 1 | --- compat/closefrom.c.orig |
| 2 | +++ compat/closefrom.c |
| 3 | @@ -27,6 +27,7 @@ |
| 4 | #include <sys/time.h> /* for <sys/resource.h> */ |
| 5 | #include <sys/resource.h> /* getrlimit() */ |
| 6 | #include <unistd.h> |
| 7 | +#include <fcntl.h> |
| 8 | #include <errno.h> /* errno */ |
| 9 | #include <sys/select.h> /* FD_SETSIZE */ |
| 10 | |
| 11 | @@ -74,7 +75,11 @@ |
| 12 | } |
| 13 | |
| 14 | while ((unsigned)fd < lim.rlim_max) |
| 15 | +#ifdef __APPLE__ |
| 16 | + if (fcntl (fd++, F_SETFD, FD_CLOEXEC) != -1) |
| 17 | +#else |
| 18 | if (close (fd++) == 0) |
| 19 | +#endif |
| 20 | found++; |
| 21 | |
| 22 | if (found == 0) |