From 04c8461550a698dbb7e47aae1775b50e51cc1151 Mon Sep 17 00:00:00 2001 From: dugsong Date: Sun, 19 Nov 2000 14:26:15 +0000 Subject: [PATCH] sleeping 15 seconds on ENOBUFS is silly --- net/nmap/patches/patch-tcpip.c | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 net/nmap/patches/patch-tcpip.c diff --git a/net/nmap/patches/patch-tcpip.c b/net/nmap/patches/patch-tcpip.c new file mode 100644 index 00000000000..4c5e7517d2b --- /dev/null +++ b/net/nmap/patches/patch-tcpip.c @@ -0,0 +1,38 @@ +--- tcpip.c.orig Sun Nov 19 09:13:48 2000 ++++ tcpip.c Sun Nov 19 09:18:17 2000 +@@ -317,27 +317,19 @@ + + struct sockaddr_in *sin = (struct sockaddr_in *) to; + int res; +-int retries = 0; +-int sleeptime = 0; + +-do { +- if (TCPIP_DEBUGGING > 1) { +- log_write(LOG_STDOUT, "trying sendto(%d, packet, %d, 0, %s, %d)", +- sd, len, inet_ntoa(sin->sin_addr), tolen); +- } +- if ((res = sendto(sd, (const char *) packet, len, flags, to, tolen)) == -1) { ++if (TCPIP_DEBUGGING > 1) { ++ log_write(LOG_STDOUT, "trying sendto(%d, packet, %d, 0, %s, %d)", ++ sd, len, inet_ntoa(sin->sin_addr), tolen); ++} ++while ((res = sendto(sd, (const char *) packet, len, flags, to, tolen)) == -1) { ++ if (errno != ENOBUFS) { + error("sendto in %s: sendto(%d, packet, %d, 0, %s, %d) => %s", + functionname, sd, len, inet_ntoa(sin->sin_addr), tolen, + strerror(errno)); +- if (retries > 2 || errno == EPERM) +- return -1; +- sleeptime = 15 * (1 << (2 * retries)); +- error("Sleeping %d seconds then retrying", sleeptime); +- fflush(stderr); +- sleep(sleeptime); ++ return -1; + } +- retries++; +-} while( res == -1); ++} + + if (TCPIP_DEBUGGING > 1) + log_write(LOG_STDOUT, "successfully sent %d bytes of raw_tcp!\n", res);