all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob ae65a6c8f0b384ba0e73b27dab106e02069d5651 1386 bytes (raw)
name: gnu/packages/patches/netcat-openbsd-0004-poll-hup.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
 
This patch is based on db2b1d9a8d4644ef892f47d84606ee96598d23fb
of http://anonscm.debian.org/cgit/collab-maint/netcat-openbsd.git

From: Aron Xu <aron@debian.org>
Date: Mon, 13 Feb 2012 15:08:33 +0800
Subject: poll hup

---
 netcat.c |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/netcat.c b/netcat.c
index d912544..fdaca44 100644
--- a/netcat.c
+++ b/netcat.c
@@ -884,9 +884,7 @@ readwrite(int nfd)
 			if ((n = read(nfd, buf, plen)) < 0)
 				return;
 			else if (n == 0) {
-				shutdown(nfd, SHUT_RD);
-				pfd[0].fd = -1;
-				pfd[0].events = 0;
+				goto shutdown_rd;
 			} else {
 				if (tflag)
 					atelnet(nfd, buf, n);
@@ -894,18 +892,30 @@ readwrite(int nfd)
 					return;
 			}
 		}
+		else if (pfd[0].revents & POLLHUP) {
+		shutdown_rd:
+			shutdown(nfd, SHUT_RD);
+			pfd[0].fd = -1;
+			pfd[0].events = 0;
+		}

-		if (!dflag && pfd[1].revents & POLLIN) {
+		if (!dflag) {
+		    if(pfd[1].revents & POLLIN) {
 			if ((n = read(wfd, buf, plen)) < 0)
 				return;
 			else if (n == 0) {
-				shutdown(nfd, SHUT_WR);
-				pfd[1].fd = -1;
-				pfd[1].events = 0;
+				goto shutdown_wr;
 			} else {
 				if (atomicio(vwrite, nfd, buf, n) != n)
 					return;
 			}
+			}
+			else if (pfd[1].revents & POLLHUP) {
+			shutdown_wr:
+				shutdown(nfd, SHUT_WR);
+				pfd[1].fd = -1;
+				pfd[1].events = 0;
+			}
 		}
 	}
 }
--

debug log:

solving ae65a6c ...
found ae65a6c in https://yhetil.org/guix/20160622110046.GA12755@shadowwalker/

applying [1/1] https://yhetil.org/guix/20160622110046.GA12755@shadowwalker/
diff --git a/gnu/packages/patches/netcat-openbsd-0004-poll-hup.patch b/gnu/packages/patches/netcat-openbsd-0004-poll-hup.patch
new file mode 100644
index 0000000..ae65a6c

1:23: space before tab in indent.
 			if ((n = read(nfd, buf, plen)) < 0)
1:24: space before tab in indent.
 				return;
1:25: space before tab in indent.
 			else if (n == 0) {
1:30: space before tab in indent.
 			} else {
1:31: space before tab in indent.
 				if (tflag)
Checking patch gnu/packages/patches/netcat-openbsd-0004-poll-hup.patch...
Applied patch gnu/packages/patches/netcat-openbsd-0004-poll-hup.patch cleanly.
warning: squelched 13 whitespace errors
warning: 18 lines add whitespace errors.

skipping https://yhetil.org/guix/20160622110046.GA12755@shadowwalker/ for ae65a6c
index at:
100644 ae65a6c8f0b384ba0e73b27dab106e02069d5651	gnu/packages/patches/netcat-openbsd-0004-poll-hup.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.