aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;