patch-src_tcpspray_c 1.5 KB

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