Re: [patch] Fix closing socket twice bug in netcat program

2018-09-06 Thread Nan Xiao
Hi bluhm, Very sorry for my remiss! Updated, thanks! Index: netcat.c === RCS file: /cvs/src/usr.bin/nc/netcat.c,v retrieving revision 1.192 diff -u -p -r1.192 netcat.c --- netcat.c10 Aug 2018 17:15:22 - 1.192 +++

Re: [patch] Fix closing socket twice bug in netcat program

2018-09-06 Thread Alexander Bluhm
On Thu, Sep 06, 2018 at 06:27:15PM +0800, Nan Xiao wrote: > @@ -564,8 +564,11 @@ main(int argc, char *argv[]) > } > /* Allow only one connection at a time, but stay alive. */ > for (;;) { > - if (family != AF_UNIX) > +

Re: [patch] Fix closing socket twice bug in netcat program

2018-09-06 Thread Nan Xiao
Hi bluhm, Thanks for your reply! I think your method is better, and I update the patch: Index: netcat.c === RCS file: /cvs/src/usr.bin/nc/netcat.c,v retrieving revision 1.192 diff -u -p -r1.192 netcat.c --- netcat.c10 Aug 2018

Re: [patch] Fix closing socket twice bug in netcat program

2018-09-05 Thread Alexander Bluhm
On Tue, Sep 04, 2018 at 01:01:38PM +0800, Nan Xiao wrote: > Before netcat program exits, it will check whether s is -1, and close > socket if s is not -1: > > if (s != -1) > close(s); > > The following patch fixes the issue that netcat will close socket twice > if it works as

Re: [patch] Fix closing socket twice bug in netcat program

2018-09-05 Thread Nan Xiao
Ping tech@, Could anyone spare a minute to check this patch? I think it is indeed a bug. On 9/4/2018 1:01 PM, Nan Xiao wrote: > Hi tech@, > > Before netcat program exits, it will check whether s is -1, and close > socket if s is not -1: > > if (s != -1) > close(s); > > The

[patch] Fix closing socket twice bug in netcat program

2018-09-03 Thread Nan Xiao
Hi tech@, Before netcat program exits, it will check whether s is -1, and close socket if s is not -1: if (s != -1) close(s); The following patch fixes the issue that netcat will close socket twice if it works as a server: Index: netcat.c