Problem with latest OpenSSH - 2.5.2p2

Jim Knoble jmknoble at jmknoble.cx
Sat Apr 14 06:37:23 EST 2001


Circa 2001-Apr-14 00:11:39 +1000 dixit Damien Miller:

: On Thu, 12 Apr 2001, Lutz Jaenicke wrote:
: > There is no check for EINTR (and EAGAIN), and the occurance of EINTR
: > would be treated as error.
: 
: Does this work?
: 
: Index: clientloop.c
: ===================================================================
: RCS file: /cvs/src/usr.bin/ssh/clientloop.c,v
: retrieving revision 1.61
: diff -u -r1.61 clientloop.c
: --- clientloop.c	2001/04/08 11:27:33	1.61
: +++ clientloop.c	2001/04/13 14:07:41
: @@ -671,7 +671,9 @@
:  	/* Read input from stdin. */
:  	if (FD_ISSET(fileno(stdin), readset)) {
:  		/* Read as much as possible. */
: -		len = read(fileno(stdin), buf, sizeof(buf));
: +		do
: +			len = read(fileno(stdin), buf, sizeof(buf));
: +		while (len == -1 && (errno == EINTR || errno == EAGAIN));
                                                      ^^^^^^^^^^^^^^^^^

Damien, is stdin set up for non-blocking I/O at this point?  If it is,
then retrying the read() after EAGAIN is liable to cause ssh to
effectively block (by spinning in this loop) until there's some input
on stdin.  If stdin isn't set up for non-blocking I/O, then why would
read() return EAGAIN?

Wouldn't it make more sense to simply return from
client_process_input() on EAGAIN?

:  		if (len <= 0) {
:  			/*
:  			 * Received EOF or error.  They are treated

-- 
jim knoble | jmknoble at jmknoble.cx | http://www.jmknoble.cx/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 249 bytes
Desc: not available
Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20010413/d077e51b/attachment.bin 


More information about the openssh-unix-dev mailing list