summaryrefslogtreecommitdiff
path: root/package/ndisc6/patches/patch-src_tcpspray_c
blob: 9ac8bad903fb94ecc7d34d9e2cce8c67337eb4fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$Id: update-patches 24 2008-08-31 14:56:13Z wbx $
--- ndisc6-0.9.8.orig/src/tcpspray.c	2008-05-01 14:52:28.000000000 +0200
+++ ndisc6-0.9.8/src/tcpspray.c	2009-05-10 19:13:52.000000000 +0200
@@ -60,7 +60,7 @@ static unsigned verbose = 0;
 
 static int tcpconnect (const char *host, const char *serv)
 {
-	struct addrinfo hints, *res;
+	struct addrinfo hints, *res, *p;
 
 	memset (&hints, 0, sizeof (hints));
 	hints.ai_family = family;
@@ -78,7 +78,7 @@ static int tcpconnect (const char *host,
 
 	val = -1;
 
-	for (struct addrinfo *p = res; (p != NULL) && (val == -1); p = p->ai_next)
+	for (p = res; (p != NULL) && (val == -1); p = p->ai_next)
 	{
 		val = socket (p->ai_family, p->ai_socktype, p->ai_protocol);
 		if (val == -1)
@@ -127,6 +127,8 @@ static int
 tcpspray (const char *host, const char *serv, unsigned long n, size_t blen,
           unsigned delay_us, const char *fillname, bool echo)
 {
+	unsigned int i, j;
+
 	if (serv == NULL)
 		serv = echo ? "echo" : "discard";
 
@@ -172,7 +174,7 @@ tcpspray (const char *host, const char *
 		switch (child)
 		{
 			case 0:
-				for (unsigned i = 0; i < n; i++)
+				for (i = 0; i < n; i++)
 				{
 					ssize_t val = recv (fd, block, blen, MSG_WAITALL);
 					if (val != (ssize_t)blen)
@@ -208,7 +210,7 @@ tcpspray (const char *host, const char *
 	struct timespec start, end;
 	mono_gettime (&start);
 
-	for (unsigned i = 0; i < n; i++)
+	for (j = 0; j < n; j++)
 	{
 		ssize_t val = write (fd, block, blen);
 		if (val != (ssize_t)blen)