# HG changeset patch # User Matt Johnston # Date 1407334096 -28800 # Node ID 9e7b0810a4a2fcf0790a5e45871b3c92abc0d7d3 # Parent c4f138dae2fd16b6ce74bbe5685940b83db2f756# Parent f92394f3f3323252b0e03b74afee45e77eb4e4bc merge diff -r f92394f3f332 -r 9e7b0810a4a2 packet.c --- a/packet.c Wed Aug 06 22:04:49 2014 +0800 +++ b/packet.c Wed Aug 06 22:08:16 2014 +0800 @@ -93,9 +93,12 @@ iov[i].iov_base = buf_getptr(writebuf, len); iov[i].iov_len = len; } + /* This may return EAGAIN. The main loop sometimes + calls write_packet() without bothering to test with select() since + it's likely to be necessary */ written = writev(ses.sock_out, iov, iov_max_count); if (written < 0) { - if (errno == EINTR) { + if (errno == EINTR || errno == EAGAIN) { m_free(iov); TRACE2(("leave write_packet: EINTR")) return; @@ -136,7 +139,7 @@ written = write(ses.sock_out, buf_getptr(writebuf, len), len); if (written < 0) { - if (errno == EINTR) { + if (errno == EINTR || errno == EAGAIN) { TRACE2(("leave writepacket: EINTR")) return; } else { @@ -255,7 +258,7 @@ ses.remoteclosed(); } if (slen < 0) { - if (errno == EINTR) { + if (errno == EINTR || errno == EAGAIN) { TRACE2(("leave read_packet_init: EINTR")) return DROPBEAR_FAILURE; }