aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorPaul Fox <pgf@brightstareng.com>2005-07-18 22:23:16 +0000
committerPaul Fox <pgf@brightstareng.com>2005-07-18 22:23:16 +0000
commit7b71d740b9186633b9a4b1d05247376485e2b805 (patch)
tree453d47ed9248f96afc553b3ed48527ce6d81ca22 /networking
parentd13b90b9e8985e5787621f82d7cc5d29a8ae32ea (diff)
downloadbusybox-7b71d740b9186633b9a4b1d05247376485e2b805.tar.gz
fix for "0000027: patch: nc will spin if stdin closed"
Diffstat (limited to 'networking')
-rw-r--r--networking/nc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/nc.c b/networking/nc.c
index 58cd39fac..bf155b3b1 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -175,8 +175,11 @@ int nc_main(int argc, char **argv)
exit(0);
ofd = STDOUT_FILENO;
} else {
- if (nread == 0)
- shutdown(sfd, 1);
+ if (nread <= 0) {
+ shutdown(sfd, 1 /* send */ );
+ close(STDIN_FILENO);
+ FD_CLR(STDIN_FILENO, &readfds);
+ }
ofd = sfd;
}