1
0

patch-rdnssd_rdnssd_c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
  2. --- ndisc6-0.9.8.orig/rdnssd/rdnssd.c 2008-05-01 14:52:28.000000000 +0200
  3. +++ ndisc6-0.9.8/rdnssd/rdnssd.c 2009-05-10 19:42:36.000000000 +0200
  4. @@ -76,6 +76,7 @@ static struct
  5. static void write_resolv(const char *resolvpath)
  6. {
  7. + size_t i;
  8. FILE *resolv;
  9. int rval;
  10. char tmpfile[strlen(resolvpath) + sizeof(".tmp")];
  11. @@ -89,7 +90,7 @@ static void write_resolv(const char *res
  12. return;
  13. }
  14. - for (size_t i = 0; i < servers.count; i++) {
  15. + for (i = 0; i < servers.count; i++) {
  16. char addr[INET6_ADDRSTRLEN];
  17. inet_ntop(AF_INET6, &servers.list[i].addr, addr, INET6_ADDRSTRLEN);
  18. @@ -132,6 +133,7 @@ static int rdnss_older (const void *a, c
  19. static void rdnss_update (const struct in6_addr *addr, unsigned int ifindex, time_t expiry)
  20. {
  21. size_t i;
  22. + unsigned int j;
  23. /* Does this entry already exist? */
  24. for (i = 0; i < servers.count; i++)
  25. @@ -165,12 +167,12 @@ static void rdnss_update (const struct i
  26. qsort (servers.list, servers.count, sizeof (rdnss_t), rdnss_older);
  27. #ifndef NDEBUG
  28. - for (unsigned i = 0; i < servers.count; i++)
  29. + for (j = 0; j < servers.count; j++)
  30. {
  31. char buf[INET6_ADDRSTRLEN];
  32. - inet_ntop (AF_INET6, &servers.list[i].addr, buf,
  33. + inet_ntop (AF_INET6, &servers.list[j].addr, buf,
  34. sizeof (buf));
  35. - syslog (LOG_DEBUG, "%u: %48s expires at %u\n", i, buf,
  36. + syslog (LOG_DEBUG, "%u: %48s expires at %u\n", j, buf,
  37. (unsigned)servers.list[i].expiry);
  38. }
  39. #endif
  40. @@ -178,6 +180,7 @@ static void rdnss_update (const struct i
  41. int parse_nd_opts (const struct nd_opt_hdr *opt, size_t opts_len, unsigned int ifindex)
  42. {
  43. + struct in6_addr *addr;
  44. for (; opts_len >= sizeof(struct nd_opt_hdr);
  45. opts_len -= opt->nd_opt_len << 3,
  46. opt = (const struct nd_opt_hdr *)
  47. @@ -206,7 +209,7 @@ int parse_nd_opts (const struct nd_opt_h
  48. lifetime = now + ntohl(rdnss_opt->nd_opt_rdnss_lifetime);
  49. - for (struct in6_addr *addr = (struct in6_addr *) (rdnss_opt + 1);
  50. + for (addr = (struct in6_addr *) (rdnss_opt + 1);
  51. nd_opt_len >= 2; addr++, nd_opt_len -= 2)
  52. rdnss_update(addr, ifindex, lifetime);
  53. @@ -255,6 +258,7 @@ static void ignore_handler (int signum)
  54. static int worker (int pipe, const char *resolvpath, const char *username)
  55. {
  56. + bool ready;
  57. sigset_t emptyset;
  58. int rval = 0, sock = -1;
  59. const rdnss_src_t *src;
  60. @@ -283,7 +287,7 @@ static int worker (int pipe, const char
  61. sigemptyset (&emptyset);
  62. - for (bool ready = false; termsig == 0;)
  63. + for (ready = false; termsig == 0;)
  64. {
  65. struct pollfd pfd =
  66. { .fd = sock, .events = POLLIN, .revents = 0 };