Bug when flushing data in openssh 2.9
Michael Widenius
monty at mysql.com
Thu Oct 18 05:27:27 EST 2001
Hi!
I am use SuSe 7.2 x86 and openssh-2.9p1-7.rpm
I got a problem using bitkeeper on my laptop where bitkeeper
reported an I/O error while reading data from 'ssh'.
After much debugging, and some help from the bitkeeper people, I found
out that that clientloop.c doesn't handle interrupts gracefully.
(It died when it got an EAGAIN error when writing to the application)
After applying the following patch, everything started to work for me:
*** clientloop-old.c Wed Oct 17 22:05:30 2001
--- clientloop.c Wed Oct 17 22:01:46 2001
***************
*** 937,947 ****
}
/* Output any buffered data for stdout. */
while (buffer_len(&stdout_buffer) > 0) {
len = write(fileno(stdout), buffer_ptr(&stdout_buffer),
buffer_len(&stdout_buffer));
! if (len <= 0) {
! error("Write failed flushing stdout buffer.");
! break;
}
buffer_consume(&stdout_buffer, len);
stdout_bytes += len;
--- 937,953 ----
}
/* Output any buffered data for stdout. */
while (buffer_len(&stdout_buffer) > 0) {
+ errno=0; /* Linux doesn't reset this */
len = write(fileno(stdout), buffer_ptr(&stdout_buffer),
buffer_len(&stdout_buffer));
! if (len <= 0)
! {
! if (errno != EAGAIN && errno != EINTR)
! {
! error("Write failed flushing stdout buffer.");
! break;
! }
! continue;
}
buffer_consume(&stdout_buffer, len);
stdout_bytes += len;
Regards,
Monty
CTO of MySQL AB
More information about the openssh-unix-dev
mailing list