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

Collapse All | Expand All

(-)channels.c (-6 / +4 lines)
Lines 1449-1459 channel_handle_rfd(Channel *c, fd_set *r Link Here
1449
	int len;
1449
	int len;
1450
1450
1451
	if (c->rfd != -1 &&
1451
	if (c->rfd != -1 &&
1452
	    (c->detach_close || FD_ISSET(c->rfd, readset))) {
1452
	    FD_ISSET(c->rfd, readset)) {
1453
		errno = 0;
1453
		errno = 0;
1454
		len = read(c->rfd, buf, sizeof(buf));
1454
		len = read(c->rfd, buf, sizeof(buf));
1455
		if (len < 0 && (errno == EINTR ||
1455
		if (len < 0 && (errno == EINTR || errno == EAGAIN))
1456
		    (errno == EAGAIN && !(c->isatty && c->detach_close))))
1457
			return 1;
1456
			return 1;
1458
#ifndef PTY_ZEROREAD
1457
#ifndef PTY_ZEROREAD
1459
		if (len <= 0) {
1458
		if (len <= 0) {
Lines 1605-1616 channel_handle_efd(Channel *c, fd_set *r Link Here
1605
				c->local_consumed += len;
1604
				c->local_consumed += len;
1606
			}
1605
			}
1607
		} else if (c->extended_usage == CHAN_EXTENDED_READ &&
1606
		} else if (c->extended_usage == CHAN_EXTENDED_READ &&
1608
		    (c->detach_close || FD_ISSET(c->efd, readset))) {
1607
		    FD_ISSET(c->efd, readset)) {
1609
			len = read(c->efd, buf, sizeof(buf));
1608
			len = read(c->efd, buf, sizeof(buf));
1610
			debug2("channel %d: read %d from efd %d",
1609
			debug2("channel %d: read %d from efd %d",
1611
			    c->self, len, c->efd);
1610
			    c->self, len, c->efd);
1612
			if (len < 0 && (errno == EINTR ||
1611
			if (len < 0 && (errno == EINTR || errno == EAGAIN))
1613
			    (errno == EAGAIN && !c->detach_close)))
1614
				return 1;
1612
				return 1;
1615
			if (len <= 0) {
1613
			if (len <= 0) {
1616
				debug2("channel %d: closing read-efd %d",
1614
				debug2("channel %d: closing read-efd %d",
(-)serverloop.c (-16 / +4 lines)
Lines 280-286 wait_until_can_do_something(fd_set **rea Link Here
280
	struct timeval tv, *tvp;
280
	struct timeval tv, *tvp;
281
	int ret;
281
	int ret;
282
	int client_alive_scheduled = 0;
282
	int client_alive_scheduled = 0;
283
	int program_alive_scheduled = 0;
284
283
285
	/*
284
	/*
286
	 * if using client_alive, set the max timeout accordingly,
285
	 * if using client_alive, set the max timeout accordingly,
Lines 318-324 wait_until_can_do_something(fd_set **rea Link Here
318
		 * the client, try to get some more data from the program.
317
		 * the client, try to get some more data from the program.
319
		 */
318
		 */
320
		if (packet_not_very_much_data_to_write()) {
319
		if (packet_not_very_much_data_to_write()) {
321
			program_alive_scheduled = child_terminated;
322
			if (!fdout_eof)
320
			if (!fdout_eof)
323
				FD_SET(fdout, *readsetp);
321
				FD_SET(fdout, *readsetp);
324
			if (!fderr_eof)
322
			if (!fderr_eof)
Lines 364-379 wait_until_can_do_something(fd_set **rea Link Here
364
		memset(*writesetp, 0, *nallocp);
362
		memset(*writesetp, 0, *nallocp);
365
		if (errno != EINTR)
363
		if (errno != EINTR)
366
			error("select: %.100s", strerror(errno));
364
			error("select: %.100s", strerror(errno));
367
	} else {
365
	} else if (ret == 0 && client_alive_scheduled)
368
		if (ret == 0 && client_alive_scheduled)
366
		client_alive_check();
369
			client_alive_check();
370
		if (!compat20 && program_alive_scheduled && fdin_is_tty) {
371
			if (!fdout_eof)
372
				FD_SET(fdout, *readsetp);
373
			if (!fderr_eof)
374
				FD_SET(fderr, *readsetp);
375
		}
376
	}
377
367
378
	notify_done(*readsetp);
368
	notify_done(*readsetp);
379
}
369
}
Lines 417-424 process_input(fd_set *readset) Link Here
417
	if (!fdout_eof && FD_ISSET(fdout, readset)) {
407
	if (!fdout_eof && FD_ISSET(fdout, readset)) {
418
		errno = 0;
408
		errno = 0;
419
		len = read(fdout, buf, sizeof(buf));
409
		len = read(fdout, buf, sizeof(buf));
420
		if (len < 0 && (errno == EINTR ||
410
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
421
		    (errno == EAGAIN && !child_terminated))) {
422
			/* do nothing */
411
			/* do nothing */
423
#ifndef PTY_ZEROREAD
412
#ifndef PTY_ZEROREAD
424
		} else if (len <= 0) {
413
		} else if (len <= 0) {
Lines 436-443 process_input(fd_set *readset) Link Here
436
	if (!fderr_eof && FD_ISSET(fderr, readset)) {
425
	if (!fderr_eof && FD_ISSET(fderr, readset)) {
437
		errno = 0;
426
		errno = 0;
438
		len = read(fderr, buf, sizeof(buf));
427
		len = read(fderr, buf, sizeof(buf));
439
		if (len < 0 && (errno == EINTR ||
428
		if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
440
		    (errno == EAGAIN && !child_terminated))) {
441
			/* do nothing */
429
			/* do nothing */
442
#ifndef PTY_ZEROREAD
430
#ifndef PTY_ZEROREAD
443
		} else if (len <= 0) {
431
		} else if (len <= 0) {

Return to bug 1306