Mercurial > hg > toybox
diff toys/netcat.c @ 323:dd0b130edf6d
Shell $(netcat) won't return unless child's stdin/stdout/stderr are closed.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 16 Nov 2008 02:41:04 -0600 |
parents | fa0a95ae4303 |
children | 50c8afc263ee |
line wrap: on
line diff
--- a/toys/netcat.c Sun Nov 16 01:57:06 2008 -0600 +++ b/toys/netcat.c Sun Nov 16 02:41:04 2008 -0600 @@ -149,8 +149,12 @@ } // 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;