Problem with latest OpenSSH - 2.5.2p2
Lutz Jaenicke
Lutz.Jaenicke at aet.TU-Cottbus.DE
Fri Apr 13 07:00:10 EST 2001
On Thu, Apr 12, 2001 at 04:38:14PM -0400, Jim Knoble wrote:
> : There is no check for EINTR (and EAGAIN), and the occurance of EINTR
> : would be treated as error.
> : Without fully analyzing the code (I just jumped into it), it should be
> : sufficient to insert
> : if (len <= 0) {
> : /*
> : * Received EOF or error. They are treated
> : * similarly, except that an error message is printed
> : * if it was an error condition.
> : */
> : if (len < 0) {
> : + if ((errno == EINTR) || (errno == EAGAIN))
> : + continue;
>
> Don't you mean 'return;'? There's no enclosing loop in
> client_process_input().
Arrghh. Of course you are right. I actually wanted to form a loop around it
when the telephone rang and I finished the mail just thereafter. Without
a loop ...
(The lesson is obvious: don't answer phone calls while writing emails :-)
> This technique doesn't restart the read() if it was interrupted.
> Shouldn't it read something like the following?
Yes :-)
>
> restart_interrupted:
> len = read(fileno(stdin), buf, sizeof(buf));
> if (len <= 0) {
> if (len < 0) {
> if (EINTR == errno) {
> /* Interrupted by signal. */
> goto restart_interrupted;
> } else if ((EAGAIN == errno) || (EWOULDBLOCK == errno)) {
> /* Read operation would block; come back later. */
> return;
> } else {
> /* An actual error. */
> snprintf(buf, sizeof buf, "read: %.100s\r\n", strerror(errno));
> buffer_append(&tderro_buffer, buf, strlen(buf));
> }
> }
> stdin_eof = 1;
> /* etc. */
> }
Best regards,
Lutz
--
Lutz Jaenicke Lutz.Jaenicke at aet.TU-Cottbus.DE
BTU Cottbus http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus Fax. +49 355 69-4153
More information about the openssh-unix-dev
mailing list