diff options
author | Fabian Groffen <grobian@gentoo.org> | 2018-12-06 11:33:27 +0100 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2018-12-06 11:33:42 +0100 |
commit | ecaa995bf0658be5b8295624d14cc023b3c09e58 (patch) | |
tree | fdc238b0c860afc9e31b1f71b417a006d9047b6f | |
parent | sci-misc/mendeleydesktop: Drop broken 1.17.13-r1 (diff) | |
download | gentoo-ecaa995bf0658be5b8295624d14cc023b3c09e58.tar.gz gentoo-ecaa995bf0658be5b8295624d14cc023b3c09e58.tar.bz2 gentoo-ecaa995bf0658be5b8295624d14cc023b3c09e58.zip |
net-analyzer/openbsd-netcat: complete Darwin patch to fix compilation
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
-rw-r--r-- | net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch | 47 |
1 files changed, 47 insertions, 0 deletions
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 index 818b13a81a59..e1a462e746b7 100644 --- a/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch +++ b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.190-darwin.patch @@ -75,6 +75,53 @@ index a0fb51b..bbb5dd1 100644 int main(int argc, char *argv[]) { +@@ -814,9 +814,8 @@ + # endif + } else { + len = sizeof(cliaddr); +- connfd = accept4(s, (struct sockaddr *)&cliaddr, +- &len, SOCK_NONBLOCK); +- if (connfd == -1) { ++ connfd = accept(s, (struct sockaddr *)&cliaddr, &len); ++ if (connfd == -1 || fcntl(connfd, F_SETFL, O_NONBLOCK) == -1) { + /* For now, all errnos are fatal */ + err(1, "accept"); + } +@@ -1092,14 +1091,16 @@ + int s, save_errno; + + if (uflag) { +- if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) < 0) ++ if ((s = unix_bind(unix_dg_tmp_socket, 0)) < 0) + return -1; + } else { +- if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) { ++ if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + errx(1,"create unix socket failed"); + return -1; + } + } ++ if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) ++ return -1; + + memset(&s_un, 0, sizeof(struct sockaddr_un)); + s_un.sun_family = AF_UNIX; +@@ -1174,9 +1175,13 @@ + port, gai_strerror(error)); + + for (res = res0; res; res = res->ai_next) { +- if ((s = socket(res->ai_family, res->ai_socktype | +- SOCK_NONBLOCK, res->ai_protocol)) < 0) ++ if ((s = socket(res->ai_family, res->ai_socktype, ++ res->ai_protocol)) < 0) ++ continue; ++ if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) { ++ close(s); + continue; ++ } + + /* Bind to a local port or source address if specified. */ + if (sflag || pflag) { diff --git a/socks.c b/socks.c index 9068f39..68b68e3 100644 --- a/socks.c |