aboutsummaryrefslogtreecommitdiff
path: root/network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch
diff options
context:
space:
mode:
authorDonald Cooley <chytraeus@protonmail.com>2020-02-08 02:00:33 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-02-08 02:00:33 +0700
commitd1958c4a94b3ae2f24faeb8aa828d2065b36ee13 (patch)
tree11ce09c8e8aa00f7122923cf830a8f807d0ac328 /network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch
parent960bca1643f56ff4393a9339847467a8f8a7c361 (diff)
network/netcat-openbsd: Updated for version 1.206.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch')
-rw-r--r--network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch72
1 files changed, 23 insertions, 49 deletions
diff --git a/network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch b/network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch
index 0d3ea68b96..3d6c4ad9a6 100644
--- a/network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch
+++ b/network/netcat-openbsd/patches/0010-serialized-handling-multiple-clients.patch
@@ -3,15 +3,13 @@ Date: Tue, 14 Feb 2012 23:02:00 +0800
Subject: serialized handling multiple clients
---
- netcat.c | 39 +++++++++++++++++++--------------------
- 1 file changed, 19 insertions(+), 20 deletions(-)
+ netcat.c | 17 ++++++++---------
+ 1 file changed, 8 insertions(+), 9 deletions(-)
-diff --git a/netcat.c b/netcat.c
-index 56cc15e..bf9940f 100644
--- a/netcat.c
+++ b/netcat.c
-@@ -447,26 +447,24 @@ main(int argc, char *argv[])
- s = unix_bind(host);
+@@ -708,7 +708,10 @@ main(int argc, char *argv[])
+ s = unix_bind(host, 0);
else
s = unix_listen(host);
- }
@@ -19,57 +17,33 @@ index 56cc15e..bf9940f 100644
+ s = local_listen(host, uport, hints);
+ if (s < 0)
+ err(1, NULL);
-+
-+ char* local;
-+ if (family == AF_INET6)
-+ local = ":::";
-+ else
-+ local = "0.0.0.0";
-+ fprintf(stderr, "Listening on [%s] (family %d, port %d)\n",
-+ host ?: local,
-+ family,
-+ *uport);
+ # if defined(TLS)
+ if (usetls) {
+@@ -722,13 +725,6 @@ main(int argc, char *argv[])
+ # endif
/* Allow only one connection at a time, but stay alive. */
for (;;) {
-- if (family != AF_UNIX)
+- if (family != AF_UNIX) {
+- if (s != -1)
+- close(s);
- s = local_listen(host, uport, hints);
-- if (s < 0)
+- }
+- if (s == -1)
- err(1, NULL);
-
-- char* local;
-- if (family == AF_INET6 )
-- local = "0.0.0.0";
-- else if (family == AF_INET)
-- local = ":::";
-- else
-- local = "unknown";
-- fprintf(stderr, "Listening on [%s] (family %d, port %d)\n",
-- host ?: local,
-- family,
-- *uport);
- /*
- * For UDP, we will use recvfrom() initially
- * to wait for a caller, then use the regular
-@@ -536,15 +534,16 @@ main(int argc, char *argv[])
- close(connfd);
- }
-
-- if (family != AF_UNIX)
-+ if (kflag)
-+ continue;
-+ if (family != AF_UNIX) {
- close(s);
-+ }
- else if (uflag) {
- if (connect(s, NULL, 0) < 0)
+ if (uflag && kflag) {
+ /*
+ * For UDP and -k, don't connect the socket,
+@@ -805,8 +801,11 @@ main(int argc, char *argv[])
err(1, "connect");
}
--
+
- if (!kflag)
-- break;
-+ break;
++ if (!kflag) {
++ if (s != -1)
++ close(s);
+ break;
++ }
}
} else if (family == AF_UNIX) {
ret = 0;
---