On Sun, 29 Mar 2020 at 18:02:00 +0200, Guilhem Moulin wrote:
>> Using TCP, ^D to server nc has no visible efect. Maybe an update to your 
>> patch
>> can fix this also. I will investicate over the next few days.
> 
> Sorry, my bad for claiming earlier that ‘-q0’ was an alias ‘-N’.  What's
> correct is what's written in the manual, namely that it *implies* ‘-N’.
> All ‘-N’ does is to call shutdown(2) after EOF on stdin; which it does,
> so I'm removing the ‘upstream’ tag on the bug.

Attached is an updated version that also causes nc to exit on EOF when
‘-l’ is set.  Will test it shortly :-)

-- 
Guilhem.
--- a/netcat.c
+++ b/netcat.c
@@ -1607,6 +1607,12 @@
 			if (pfd[POLL_NETOUT].fd != -1 && Nflag)
 				shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
 			pfd[POLL_NETOUT].fd = -1;
+			if ((lflag || uflag) && pfd[POLL_NETIN].fd != -1 &&
+			    qflag >= 0 && netinbufpos == 0) {
+				shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
+				pfd[POLL_NETIN].fd = -1;
+				kflag = 0;
+			}
 		}
 		/* net in gone and queue empty? */
 		if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) {

Attachment: signature.asc
Description: PGP signature

Reply via email to