aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-11-16 02:41:04 -0600
committerRob Landley <rob@landley.net>2008-11-16 02:41:04 -0600
commit206a832f21f7b28f32127812da5ea764f8dd2644 (patch)
tree605e526c3ba731cd6c57de7534ce34545b8db778
parent053b42c935707c8eba12ebb1b7f60dbc8c387b09 (diff)
downloadtoybox-206a832f21f7b28f32127812da5ea764f8dd2644.tar.gz
Shell $(netcat) won't return unless child's stdin/stdout/stderr are closed.
-rw-r--r--toys/netcat.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/toys/netcat.c b/toys/netcat.c
index e1cfc07f..0ed2a36a 100644
--- a/toys/netcat.c
+++ b/toys/netcat.c
@@ -149,8 +149,12 @@ void netcat_main(void)
}
// Do we need to return immediately because -l has arguments?
- if ((toys.optflags&FLAG_l) && toys.optc)
+ if ((toys.optflags&FLAG_l) && toys.optc) {
if (fork()) goto cleanup;
+ close(0);
+ close(1);
+ close(2);
+ }
for (;;) {
pid_t child = 0;