aboutsummaryrefslogtreecommitdiff
path: root/toys/net
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-05-19 01:17:38 -0500
committerRob Landley <rob@landley.net>2020-05-19 01:17:38 -0500
commit1d181824bb8fc92636d3eae52f2a0ee15117ee2f (patch)
tree0a902db1d38d10d2905eb12a5b806a231c5da55b /toys/net
parent320df9ba543cdb9e4a6c9b1f9ee3bd6f00d4e864 (diff)
downloadtoybox-1d181824bb8fc92636d3eae52f2a0ee15117ee2f.tar.gz
Don't leak sockfd into children.
Diffstat (limited to 'toys/net')
-rw-r--r--toys/net/netcat.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/net/netcat.c b/toys/net/netcat.c
index 62586054..2d80a18f 100644
--- a/toys/net/netcat.c
+++ b/toys/net/netcat.c
@@ -180,6 +180,7 @@ void netcat_main(void)
close(in1);
continue;
}
+ close(sockfd);
dup2(in1, 0);
dup2(in1, 1);
if (FLAG(E)) dup2(in1, 2);