if ((c->ostate == CHAN_OUTPUT_OPEN || c->ostate == CHAN_OUTPUT_WAIT_DRAIN) &&
if (c->wfd != -1 &&
channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset){	struct termios tio;	int len;	/* Send buffered output data to the socket. */	if ((c->ostate == CHAN_OUTPUT_OPEN ||	    c->ostate == CHAN_OUTPUT_WAIT_DRAIN) &&	    FD_ISSET(c->wfd, writeset) &&	    buffer_len(&c->output) > 0) {		len = write(c->wfd, buffer_ptr(&c->output),		    buffer_len(&c->output));		if (len < 0 && (errno == EINTR || errno == EAGAIN))			return 1;		if (len <= 0) {			if (c->type != SSH_CHANNEL_OPEN) {				debug("channel %d: not open", c->self);				chan_mark_dead(c);				return -1;			} else if (compat13) {				buffer_consume(&c->output, buffer_len(&c->output));				debug("channel %d: status set to input draining.", c->self);				c->type = SSH_CHANNEL_INPUT_DRAINING;			} else {				chan_write_failed(c);			}			return -1;		}		if (compat20 && c->isatty) {			if (tcgetattr(c->wfd, &tio) == 0 &&			    !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {				/*				 * Simulate echo to reduce the impact of				 * traffic analysis. We need to match the				 * size of a SSH2_MSG_CHANNEL_DATA message				 * (4 byte channel id + data)				 */				packet_send_ignore(4 + len);				packet_send();			}		}		buffer_consume(&c->output, len);		if (compat20 && len > 0) {			c->local_consumed += len;		}	}	return 1;}