- (djm) Suppress error messages on channel close shutdown() failurs

works around Linux bug. Patch from Zack Weinberg <zack@wolery.cumb.org>
This commit is contained in:
Damien Miller 2000-08-07 15:47:48 +10:00
parent 729e1f15d8
commit 0f091bd1fc
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,7 @@
20000807
- (djm) Set 0755 on binaries during install.
- (djm) Suppress error messages on channel close shutdown() failurs
works around Linux bug. Patch from Zack Weinberg <zack@wolery.cumb.org>
20000725
- (djm) Fix autoconf typo: HAVE_BINRESVPORT_AF -> HAVE_BINDRESVPORT_AF

View File

@ -483,7 +483,14 @@ chan_shutdown_read(Channel *c)
return;
debug("channel %d: close_read", c->self);
if (c->sock != -1) {
if (shutdown(c->sock, SHUT_RD) < 0)
/*
* shutdown(sock, SHUT_READ) may return ENOTCONN if the
* write side has been closed already. (bug on Linux)
*/
if (shutdown(c->sock, SHUT_RD) < 0
&& (errno != ENOTCONN
|| c->ostate == CHAN_OUTPUT_OPEN
|| c->ostate == CHAN_OUTPUT_WAIT_DRAIN))
error("channel %d: chan_shutdown_read: shutdown() failed for fd%d [i%d o%d]: %.100s",
c->self, c->sock, c->istate, c->ostate, strerror(errno));
} else {