From 7b71d740b9186633b9a4b1d05247376485e2b805 Mon Sep 17 00:00:00 2001 From: Paul Fox Date: Mon, 18 Jul 2005 22:23:16 +0000 Subject: [PATCH] fix for "0000027: patch: nc will spin if stdin closed" --- networking/nc.c | 7 +++++-- 1 file 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; }