fix for "0000027: patch: nc will spin if stdin closed"

This commit is contained in:
Paul Fox 2005-07-18 22:23:16 +00:00
parent d13b90b9e8
commit 7b71d740b9

View File

@ -175,8 +175,11 @@ int nc_main(int argc, char **argv)
exit(0); exit(0);
ofd = STDOUT_FILENO; ofd = STDOUT_FILENO;
} else { } else {
if (nread == 0) if (nread <= 0) {
shutdown(sfd, 1); shutdown(sfd, 1 /* send */ );
close(STDIN_FILENO);
FD_CLR(STDIN_FILENO, &readfds);
}
ofd = sfd; ofd = sfd;
} }