View | Details | Raw Unified | Return to bug 1102 | Differences between
and this patch

Collapse All | Expand All

(-)channels.c (-2 / +4 lines)
Lines 1374-1383 channel_handle_rfd(Channel *c, fd_set * Link Here
1374
1374
1375
	if (c->rfd != -1 &&
1375
	if (c->rfd != -1 &&
1376
	    FD_ISSET(c->rfd, readset)) {
1376
	    FD_ISSET(c->rfd, readset)) {
1377
		errno = 0;
1377
		len = read(c->rfd, buf, sizeof(buf));
1378
		len = read(c->rfd, buf, sizeof(buf));
1378
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1379
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1379
			return 1;
1380
			return 1;
1380
		if (len <= 0) {
1381
		if (len < 0 || (len == 0 && errno != 0)) {
1381
			debug2("channel %d: read<=0 rfd %d len %d",
1382
			debug2("channel %d: read<=0 rfd %d len %d",
1382
			    c->self, c->rfd, len);
1383
			    c->self, c->rfd, len);
1383
			if (c->type != SSH_CHANNEL_OPEN) {
1384
			if (c->type != SSH_CHANNEL_OPEN) {
Lines 1511-1520 channel_handle_ctl(Channel *c, fd_set * Link Here
1511
1512
1512
	/* Monitor control fd to detect if the slave client exits */
1513
	/* Monitor control fd to detect if the slave client exits */
1513
	if (c->ctl_fd != -1 && FD_ISSET(c->ctl_fd, readset)) {
1514
	if (c->ctl_fd != -1 && FD_ISSET(c->ctl_fd, readset)) {
1515
		errno = 0;
1514
		len = read(c->ctl_fd, buf, sizeof(buf));
1516
		len = read(c->ctl_fd, buf, sizeof(buf));
1515
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1517
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1516
			return 1;
1518
			return 1;
1517
		if (len <= 0) {
1519
		if (len < 0 || (len == 0 && errno != 0)) {
1518
			debug2("channel %d: ctl read<=0", c->self);
1520
			debug2("channel %d: ctl read<=0", c->self);
1519
			if (c->type != SSH_CHANNEL_OPEN) {
1521
			if (c->type != SSH_CHANNEL_OPEN) {
1520
				debug2("channel %d: not open", c->self);
1522
				debug2("channel %d: not open", c->self);
(-)serverloop.c (-2 / +4 lines)
Lines 370-379 process_input(fd_set * readset) Link Here
370
370
371
	/* Read and buffer any available stdout data from the program. */
371
	/* Read and buffer any available stdout data from the program. */
372
	if (!fdout_eof && FD_ISSET(fdout, readset)) {
372
	if (!fdout_eof && FD_ISSET(fdout, readset)) {
373
		errno = 0;
373
		len = read(fdout, buf, sizeof(buf));
374
		len = read(fdout, buf, sizeof(buf));
374
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
375
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
375
			/* do nothing */
376
			/* do nothing */
376
		} else if (len <= 0) {
377
		} else if (len < 0 || (len == 0 && errno != 0)) {
377
			fdout_eof = 1;
378
			fdout_eof = 1;
378
		} else {
379
		} else {
379
			buffer_append(&stdout_buffer, buf, len);
380
			buffer_append(&stdout_buffer, buf, len);
Lines 382-391 process_input(fd_set * readset) Link Here
382
	}
383
	}
383
	/* Read and buffer any available stderr data from the program. */
384
	/* Read and buffer any available stderr data from the program. */
384
	if (!fderr_eof && FD_ISSET(fderr, readset)) {
385
	if (!fderr_eof && FD_ISSET(fderr, readset)) {
386
		errno = 0;
385
		len = read(fderr, buf, sizeof(buf));
387
		len = read(fderr, buf, sizeof(buf));
386
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
388
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
387
			/* do nothing */
389
			/* do nothing */
388
		} else if (len <= 0) {
390
		} else if (len < 0 || (len == 0 && errno != 0)) {
389
			fderr_eof = 1;
391
			fderr_eof = 1;
390
		} else {
392
		} else {
391
			buffer_append(&stderr_buffer, buf, len);
393
			buffer_append(&stderr_buffer, buf, len);

Return to bug 1102