# HG changeset patch # User Matt Johnston # Date 1407333343 -28800 # Node ID c4f138dae2fd16b6ce74bbe5685940b83db2f756 # Parent 36eacc322e00924e511810c519bf5a3f05898cdd Test for EAGAIN too diff -r 36eacc322e00 -r c4f138dae2fd packet.c --- a/packet.c Mon Jul 28 23:23:49 2014 +0800 +++ b/packet.c Wed Aug 06 21:55:43 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; }