aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
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;
}