On Mon, Mar 18, 2013 at 03:14:59PM +0100, Martin Pelikan wrote:

> Hi!
> 
> Theo pointed out an issue with nc(1), as mentioned in
> 
> https://groups.google.com/forum/?hl=en&fromgroups=#!topic/muc.lists.freebsd.bugs/0yNFZVHClcI
> 
> and
> 
> https://bugs.launchpad.net/ubuntu/+source/netcat-openbsd/+bug/544935
> 
> that was causing people headaches.
> 
> For me, this diff (which seems like a typical copy-paste error) does the
> job.  At least with "echo 7.6.5.4 | nc whois.ripe.net 43".
> 
> Any comments?

wfd is stdin, so doing a shutdown on it will mostly be a noop, right?

ktrace it and you'll see

        -Otto


> --
> Martin Pelikan
> 
> 
> Index: netcat.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/nc/netcat.c,v
> retrieving revision 1.110
> diff -u -p -r1.110 netcat.c
> --- netcat.c  12 Mar 2013 02:57:37 -0000      1.110
> +++ netcat.c  18 Mar 2013 14:07:25 -0000
> @@ -771,7 +771,7 @@ readwrite(int nfd)
>                       if ((n = read(wfd, buf, plen)) < 0)
>                               return;
>                       else if (n == 0) {
> -                             shutdown(nfd, SHUT_WR);
> +                             shutdown(wfd, SHUT_WR);
>                               pfd[1].fd = -1;
>                               pfd[1].events = 0;
>                       } else {

Reply via email to