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

Collapse All | Expand All

(-)serverloop.c (+12 lines)
Lines 387-396 process_input(fd_set *readset) Link Here
387
387
388
	/* Read and buffer any available stdout data from the program. */
388
	/* Read and buffer any available stdout data from the program. */
389
	if (!fdout_eof && FD_ISSET(fdout, readset)) {
389
	if (!fdout_eof && FD_ISSET(fdout, readset)) {
390
		errno = 0;
390
		len = read(fdout, buf, sizeof(buf));
391
		len = read(fdout, buf, sizeof(buf));
391
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
392
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
392
			/* do nothing */
393
			/* do nothing */
394
#ifndef PTY_ZEROREAD
393
		} else if (len <= 0) {
395
		} else if (len <= 0) {
396
#else
397
		} else if ((!isatty(fdout) && len <= 0) ||
398
		    (isatty(fdout) && (len < 0 || (len == 0 && errno != 0)))) {
399
#endif
394
			fdout_eof = 1;
400
			fdout_eof = 1;
395
		} else {
401
		} else {
396
			buffer_append(&stdout_buffer, buf, len);
402
			buffer_append(&stdout_buffer, buf, len);
Lines 399-408 process_input(fd_set *readset) Link Here
399
	}
405
	}
400
	/* Read and buffer any available stderr data from the program. */
406
	/* Read and buffer any available stderr data from the program. */
401
	if (!fderr_eof && FD_ISSET(fderr, readset)) {
407
	if (!fderr_eof && FD_ISSET(fderr, readset)) {
408
		errno = 0;
402
		len = read(fderr, buf, sizeof(buf));
409
		len = read(fderr, buf, sizeof(buf));
403
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
410
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
404
			/* do nothing */
411
			/* do nothing */
412
#ifndef PTY_ZEROREAD
405
		} else if (len <= 0) {
413
		} else if (len <= 0) {
414
#else
415
		} else if ((!isatty(fderr) && len <= 0) ||
416
		    (isatty(fderr) && (len < 0 || (len == 0 && errno != 0)))) {
417
#endif
406
			fderr_eof = 1;
418
			fderr_eof = 1;
407
		} else {
419
		} else {
408
			buffer_append(&stderr_buffer, buf, len);
420
			buffer_append(&stderr_buffer, buf, len);
(-)channels.c (+5 lines)
Lines 1415-1424 channel_handle_rfd(Channel *c, fd_set *r Link Here
1415
1415
1416
	if (c->rfd != -1 &&
1416
	if (c->rfd != -1 &&
1417
	    FD_ISSET(c->rfd, readset)) {
1417
	    FD_ISSET(c->rfd, readset)) {
1418
		errno = 0;
1418
		len = read(c->rfd, buf, sizeof(buf));
1419
		len = read(c->rfd, buf, sizeof(buf));
1419
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1420
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1420
			return 1;
1421
			return 1;
1422
#ifndef PTY_ZEROREAD
1421
		if (len <= 0) {
1423
		if (len <= 0) {
1424
#else
1425
		if (len < 0 || (len == 0 && errno != 0)) {
1426
#endif
1422
			debug2("channel %d: read<=0 rfd %d len %d",
1427
			debug2("channel %d: read<=0 rfd %d len %d",
1423
			    c->self, c->rfd, len);
1428
			    c->self, c->rfd, len);
1424
			if (c->type != SSH_CHANNEL_OPEN) {
1429
			if (c->type != SSH_CHANNEL_OPEN) {

Return to bug 1102