mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-18 16:14:34 +00:00
use same close logic for stderr as stdout
Avoids sending SIGPIPE to child processes after their parent exits if they attempt to write to stderr. Analysis and patch from JD Paul; patch reworked by Jakub Jelen and myself. bz#2071; ok dtucker@
This commit is contained in:
parent
8c53d409ba
commit
03e92dd27d
@ -2100,16 +2100,18 @@ channel_handle_efd_read(struct ssh *ssh, Channel *c,
|
||||
fd_set *readset, fd_set *writeset)
|
||||
{
|
||||
char buf[CHAN_RBUF];
|
||||
int r;
|
||||
ssize_t len;
|
||||
int r, force;
|
||||
|
||||
if (!c->detach_close && !FD_ISSET(c->efd, readset))
|
||||
force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;
|
||||
|
||||
if (c->efd == -1 || (!force && !FD_ISSET(c->efd, readset)))
|
||||
return 1;
|
||||
|
||||
len = read(c->efd, buf, sizeof(buf));
|
||||
debug2("channel %d: read %zd from efd %d", c->self, len, c->efd);
|
||||
if (len < 0 && (errno == EINTR || ((errno == EAGAIN ||
|
||||
errno == EWOULDBLOCK) && !c->detach_close)))
|
||||
errno == EWOULDBLOCK) && !force)))
|
||||
return 1;
|
||||
if (len <= 0) {
|
||||
debug2("channel %d: closing read-efd %d",
|
||||
|
Loading…
Reference in New Issue
Block a user