Problem with latest OpenSSH - 2.5.2p2
Tim Rice
tim at multitalents.net
Fri Apr 13 12:35:24 EST 2001
On Thu, 12 Apr 2001, Jim Knoble wrote:
> Circa 2001-Apr-12 15:16:37 +0200 dixit Lutz Jaenicke:
>
> : On Thu, Apr 12, 2001 at 08:46:20AM -0400, Brent L. Bates wrote:
[snip]
> This technique doesn't restart the read() if it was interrupted.
> Shouldn't it read something like the following?
>
> restart_interrupted:
> len = read(fileno(stdin), buf, sizeof(buf));
> if (len <= 0) {
> if (len < 0) {
> if (EINTR == errno) {
> /* Interrupted by signal. */
> goto restart_interrupted;
^^^^^^^^^^^^^
Even if this works, find another way.
I don't think goto is portable.
> } 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. */
> }
>
> : PS. Operating systems tend to behave differently. I have never seen such
> : effects on HP-UX, while e.g. Unixware behaves completely different, as
> : I have learned when tracking down problems with EINTR in the EGD interface
> : code of OpenSSL... Therefore it is well possible, that other people not
> : working on Irix won't be able to reproduce this problem.
>
> It may well depend on whether signals restart interrupted system calls
> by default or not. See APUE.
>
>
--
Tim Rice Multitalents (707) 887-1469
tim at multitalents.net
More information about the openssh-unix-dev
mailing list