bin/176713: [patch] nc(1) closes network socket too soon

Adrian Chadd adrian at freebsd.org
Mon Jul 22 02:50:49 UTC 2013


 On 21 July 2013 19:02, Ronald F. Guilmette <rfg at tristatelogic.com> wrote:

> It has been some time now since I filed my PR but I think that the bottom
> line is that you need to look at the code (of nc) to understand how it is
> reacting to EOF on stdin.

Gah, I was kinda hoping not to look at nc, and just work with someone
else to figure out the right solution. I'm being slack :)

> My recollection is that it exits as soon as it sees that (i.e. EOF on
> its own stdin).  My proposed patch corrects this unfortunate behavior.

OK. Let me re-read this. I _think_ the correct behaviour is:

* if it's done a shutdown(fd, WR) - then it shouldn't error out on EOF
events on writes to the FD
* But it shouldn't get a read EOF on the socket until the remote side
signifies it.

Is nc seeing EOF on reading form the server side prematurely? That's
why I'm confused.



-adrian


More information about the freebsd-hackers mailing list