Package: tcputils
Severity: important
Tags: patch
Dear Maintainer,
Under certain situations tcpconnect hangs and does not read replies from
remote peer. For example, on an up-to-date jessie system (amd64):
$ tcpconnect www.debian.org http
GET / HTTP/1.1
Host: www.debian.org
^C
In fact, strace shows that tcpconnect keeps trying to read more data
from stdin.
I think that the origin for the problem is in function available_bytes()
[relay.c] where a long* argument is given to ioctl(FIONREAD), while an
int* is expected. Then, e.g. on amd64 where long != int, nbytes is only
partially initialized by the ioctl call.
The following patch fixes that.
Regards,
Arnaud Giersch
========================================================================
--- relay.c.BAK 2015-03-10 09:50:27.000000000 +0100
+++ relay.c 2015-03-10 10:32:23.665199079 +0100
@@ -24,10 +24,10 @@
/*
* Estimate how many bytes are available for reading on a file descriptor.
*/
-static long
+static int
available_bytes(int fd)
{
- long nbytes;
+ int nbytes;
struct stat sb;
off_t pos;
@@ -117,7 +117,7 @@ relay_once(struct relay * relays,
{
if (FD_ISSET(relays[i].source, &readset))
{
- long unread = available_bytes(relays[i].source);
+ int unread = available_bytes(relays[i].source);
do
{
char buffer[8192];
========================================================================
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]