[PATCH] nc: fix client hang
Tomoya Adachi
adachi at il.is.s.u-tokyo.ac.jp
Sun Aug 2 22:29:16 UTC 2009
When nc is running as a persistent server, the client's socket is not
closed in the parent process. This causes the client process to hang.
Here is a simple example:
$ ./busybox nc -l -l -p 8000 -e /bin/echo Hello &
[1] 5994
$ nc localhost 8000
Hello
<---- it doesn't return to the shell prompt
Signed-off-by: Tomoya Adachi <adachi at il.is.s.u-tokyo.ac.jp>
---
networking/nc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/networking/nc.c b/networking/nc.c
index e4db238..b344978 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -146,6 +146,7 @@ int nc_main(int argc, char **argv)
close(0);
close(1);
close(2);
+ close(cfd);
goto accept_again;
}
/* child (or main thread if no multiple -l) */
--
1.6.3.3
More information about the busybox
mailing list