rpms/nc/devel nc-1.78-pollhup.patch,NONE,1.1 nc.spec,1.16,1.17

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed May 11 10:35:25 UTC 2005


Author: dwmw2

Update of /cvs/dist/rpms/nc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20890

Modified Files:
	nc.spec 
Added Files:
	nc-1.78-pollhup.patch 
Log Message:
Don't ignore POLLHUP. 


nc-1.78-pollhup.patch:
 netcat.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

--- NEW FILE nc-1.78-pollhup.patch ---
--- nc/netcat.c~	2005-05-11 11:16:41.000000000 +0100
+++ nc/netcat.c	2005-05-11 11:30:06.000000000 +0100
@@ -624,9 +624,7 @@ readwrite(int nfd)
 			if ((n = read(nfd, buf, sizeof(buf))) < 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);
@@ -635,20 +633,30 @@ readwrite(int nfd)
 					return;
 			}
 		}
+		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 ((n = read(wfd, buf, sizeof(buf))) < 0)
 				return;
 			else if (n == 0) {
-				shutdown(nfd, SHUT_WR);
-				pfd[1].fd = -1;
-				pfd[1].events = 0;
+				goto shutdown_wr;
 			} else {
 				if (atomicio((ssize_t (*)(int, void *, size_t))write,
 				    nfd, buf, n) != n)
 					return;
 			}
 		}
+		if (pfd[1].revents & POLLHUP) {
+		shutdown_wr:
+			shutdown(nfd, SHUT_WR);
+			pfd[1].fd = -1;
+			pfd[1].events = 0;
+		}
 	}
 }
 


Index: nc.spec
===================================================================
RCS file: /cvs/dist/rpms/nc/devel/nc.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- nc.spec	11 Apr 2005 11:13:33 -0000	1.16
+++ nc.spec	11 May 2005 10:35:23 -0000	1.17
@@ -1,10 +1,11 @@
 Summary: Reads and writes data across network connections using TCP or UDP.
 Name: nc
 Version: 1.78
-Release: 1
+Release: 2
 URL:	 http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/
 Source0: nc.tar.bz2
 Patch0: nc-glib.patch
+Patch1: nc-1.78-pollhup.patch
 License: GPL
 Group: Applications/Internet
 BuildRoot: %{_tmppath}/%{name}-root
@@ -27,6 +28,7 @@
 %prep
 %setup -q -n nc
 %patch0 -p1 -b .glib
+%patch1 -p1 -b .pollhup
 
 %build
 gcc $RPM_OPT_FLAGS `pkg-config --cflags --libs glib-2.0` netcat.c atomicio.c socks.c -o nc
@@ -48,6 +50,9 @@
 %doc README scripts
 
 %changelog
+* Wed May 11 2005 David Woodhouse <dwmw2 at redhat.com> 1.78-2
+- Don't ignore POLLHUP and go into an endless loop (#156835)
+
 * Mon Apr 11 2005 Radek Vokal <rvokal at redhat.com> 1.78-1
 - update from CVS, using glib functions
 




More information about the fedora-cvs-commits mailing list