| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run |
| 2 | ## 03_fixloop.dpatch by Nico Golde <nion@debian.org> |
| 3 | ## |
| 4 | ## All lines beginning with `## DP:' are a description of the patch. |
| 5 | ## DP: No description. |
| 6 | |
| 7 | --- a/tsocks.c |
| 8 | +++ b/tsocks.c |
| 9 | @@ -990,6 +990,10 @@ static int recv_buffer(struct connreq *c |
| 10 | if (rc > 0) { |
| 11 | conn->datadone += rc; |
| 12 | rc = 0; |
| 13 | + } else if (rc == 0) { |
| 14 | + show_msg(MSGDEBUG, "Peer has shutdown but we only read %d of %d bytes.\n", |
| 15 | + conn->datadone, conn->datalen); |
| 16 | + rc = ENOTCONN; /* ENOTCONN seems like the most fitting error message */ |
| 17 | } else { |
| 18 | if (errno != EWOULDBLOCK) |
| 19 | show_msg(MSGDEBUG, "Read failed, %s\n", strerror(errno)); |