source:
npl/overig/netcat_openbsd/patches/0004-poll-hup.patch
@
128fde4
Last change on this file since 128fde4 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 1.2 KB |
-
netcat.c
From: Aron Xu <aron@debian.org> Date: Mon, 13 Feb 2012 15:08:33 +0800 Subject: poll hup --- netcat.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/netcat.c b/netcat.c index d912544..fdaca44 100644
a b readwrite(int nfd) 884 884 if ((n = read(nfd, buf, plen)) < 0) 885 885 return; 886 886 else if (n == 0) { 887 shutdown(nfd, SHUT_RD); 888 pfd[0].fd = -1; 889 pfd[0].events = 0; 887 goto shutdown_rd; 890 888 } else { 891 889 if (tflag) 892 890 atelnet(nfd, buf, n); … … readwrite(int nfd) 894 892 return; 895 893 } 896 894 } 895 else if (pfd[0].revents & POLLHUP) { 896 shutdown_rd: 897 shutdown(nfd, SHUT_RD); 898 pfd[0].fd = -1; 899 pfd[0].events = 0; 900 } 897 901 898 if (!dflag && pfd[1].revents & POLLIN) { 902 if (!dflag) { 903 if(pfd[1].revents & POLLIN) { 899 904 if ((n = read(wfd, buf, plen)) < 0) 900 905 return; 901 906 else if (n == 0) { 902 shutdown(nfd, SHUT_WR); 903 pfd[1].fd = -1; 904 pfd[1].events = 0; 907 goto shutdown_wr; 905 908 } else { 906 909 if (atomicio(vwrite, nfd, buf, n) != n) 907 910 return; 908 911 } 912 } 913 else if (pfd[1].revents & POLLHUP) { 914 shutdown_wr: 915 shutdown(nfd, SHUT_WR); 916 pfd[1].fd = -1; 917 pfd[1].events = 0; 918 } 909 919 } 910 920 } 911 921 }
Note: See TracBrowser
for help on using the repository browser.