unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob bd38c36cc270852419198fbb0ac6e49fd3cf4c58 1780 bytes (raw)
name: gnu/packages/patches/netcat-openbsd-0010-serialized-handling-multiple-clients.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
This patch is based on db2b1d9a8d4644ef892f47d84606ee96598d23fb
of http://anonscm.debian.org/cgit/collab-maint/netcat-openbsd.git

From: Aron Xu <aron@debian.org>
Date: Tue, 14 Feb 2012 23:02:00 +0800
Subject: serialized handling multiple clients

---
 netcat.c |   39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 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);
 			else
 				s = unix_listen(host);
-		}
+		} else
+			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);

 		/* Allow only one connection at a time, but stay alive. */
 		for (;;) {
-			if (family != AF_UNIX)
-				s = local_listen(host, uport, hints);
-			if (s < 0)
-				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)
 					err(1, "connect");
 			}
-
-			if (!kflag)
-				break;
+			break;
 		}
 	} else if (family == AF_UNIX) {
 		ret = 0;
--

debug log:

solving bd38c36 ...
found bd38c36 in https://yhetil.org/guix-devel/20160622110046.GA12755@shadowwalker/

applying [1/1] https://yhetil.org/guix-devel/20160622110046.GA12755@shadowwalker/
diff --git a/gnu/packages/patches/netcat-openbsd-0010-serialized-handling-multiple-clients.patch b/gnu/packages/patches/netcat-openbsd-0010-serialized-handling-multiple-clients.patch
new file mode 100644
index 0000000..bd38c36

1:23: space before tab in indent.
 				s = unix_bind(host);
1:24: space before tab in indent.
 			else
1:25: space before tab in indent.
 				s = unix_listen(host);
1:42: space before tab in indent.
 		/* Allow only one connection at a time, but stay alive. */
1:43: space before tab in indent.
 		for (;;) {
Checking patch gnu/packages/patches/netcat-openbsd-0010-serialized-handling-multiple-clients.patch...
Applied patch gnu/packages/patches/netcat-openbsd-0010-serialized-handling-multiple-clients.patch cleanly.
warning: squelched 13 whitespace errors
warning: 18 lines add whitespace errors.

skipping https://yhetil.org/guix-devel/20160622110046.GA12755@shadowwalker/ for bd38c36
index at:
100644 bd38c36cc270852419198fbb0ac6e49fd3cf4c58	gnu/packages/patches/netcat-openbsd-0010-serialized-handling-multiple-clients.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).