1 |
commit: ecaa995bf0658be5b8295624d14cc023b3c09e58 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 6 10:33:27 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 6 10:33:42 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ecaa995b |
7 |
|
8 |
net-analyzer/openbsd-netcat: complete Darwin patch to fix compilation |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
Package-Manager: Portage-2.3.51, Repoman-2.3.11 |
12 |
|
13 |
.../files/openbsd-netcat-1.190-darwin.patch | 47 ++++++++++++++++++++++ |
14 |
1 file changed, 47 insertions(+) |
15 |
|
16 |
diff --git a/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch |
17 |
index 818b13a81a5..e1a462e746b 100644 |
18 |
--- a/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch |
19 |
+++ b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch |
20 |
@@ -75,6 +75,53 @@ index a0fb51b..bbb5dd1 100644 |
21 |
int |
22 |
main(int argc, char *argv[]) |
23 |
{ |
24 |
+@@ -814,9 +814,8 @@ |
25 |
+ # endif |
26 |
+ } else { |
27 |
+ len = sizeof(cliaddr); |
28 |
+- connfd = accept4(s, (struct sockaddr *)&cliaddr, |
29 |
+- &len, SOCK_NONBLOCK); |
30 |
+- if (connfd == -1) { |
31 |
++ connfd = accept(s, (struct sockaddr *)&cliaddr, &len); |
32 |
++ if (connfd == -1 || fcntl(connfd, F_SETFL, O_NONBLOCK) == -1) { |
33 |
+ /* For now, all errnos are fatal */ |
34 |
+ err(1, "accept"); |
35 |
+ } |
36 |
+@@ -1092,14 +1091,16 @@ |
37 |
+ int s, save_errno; |
38 |
+ |
39 |
+ if (uflag) { |
40 |
+- if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) < 0) |
41 |
++ if ((s = unix_bind(unix_dg_tmp_socket, 0)) < 0) |
42 |
+ return -1; |
43 |
+ } else { |
44 |
+- if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) { |
45 |
++ if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { |
46 |
+ errx(1,"create unix socket failed"); |
47 |
+ return -1; |
48 |
+ } |
49 |
+ } |
50 |
++ if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) |
51 |
++ return -1; |
52 |
+ |
53 |
+ memset(&s_un, 0, sizeof(struct sockaddr_un)); |
54 |
+ s_un.sun_family = AF_UNIX; |
55 |
+@@ -1174,9 +1175,13 @@ |
56 |
+ port, gai_strerror(error)); |
57 |
+ |
58 |
+ for (res = res0; res; res = res->ai_next) { |
59 |
+- if ((s = socket(res->ai_family, res->ai_socktype | |
60 |
+- SOCK_NONBLOCK, res->ai_protocol)) < 0) |
61 |
++ if ((s = socket(res->ai_family, res->ai_socktype, |
62 |
++ res->ai_protocol)) < 0) |
63 |
++ continue; |
64 |
++ if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) { |
65 |
++ close(s); |
66 |
+ continue; |
67 |
++ } |
68 |
+ |
69 |
+ /* Bind to a local port or source address if specified. */ |
70 |
+ if (sflag || pflag) { |
71 |
diff --git a/socks.c b/socks.c |
72 |
index 9068f39..68b68e3 100644 |
73 |
--- a/socks.c |